Re: [whatwg/webidl] Allowing throwing an exception with a specific message (Issue #1374)

Node uses `error.code = "SOME_FIXED_STRING"` and it's great. I would love to see that adopted on the web.

I don't see any problems with it from the JS side, though it's unlikely that errors thrown by JS would get such a property  in the near future.

Do note that this can make optimizations which are formally (but not practically) unobservable suddenly be observable: right now if there's two adjacent steps which throw a TypeError and no user code runs between them, an engine can do those steps in whichever order is more convenient for it, and with this change would be required to do them in a particular order. But that's only very rarely going to be an issue, I think, and in any case users already depend on the unspecified message strings and so practically many of these things are observable anyway.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1374#issuecomment-2035626969
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1374/2035626969@github.com>

Received on Wednesday, 3 April 2024 21:29:08 UTC