Re: [whatwg/webidl] New error name: OptOutError (Issue #1168)

> That said, I am generally interested in whether we consider the set of DOMExceptions on the web 'fixed' or are still expanding it over time,

In general I would say they can be expanded, but be conservative and avoid doing so when possible.

Another case that expanded them for similar reasons is https://wicg.github.io/serial/ (Ctrl+F "BreakError", "FramingError", etc.), although they did not do the correct thing that you are doing here and open a Web IDL issue.

> and if we've put in any thought to whether DOMExceptions could carry more structured data to allow for better error handling by developers.

This has been discussed in the past. I can't find where (seems to not be on the issue tracker). I think it's pretty doable these days. It would require the following work:

- Spec authors would need to subclass DOMException.
- Spec authors would need to define serialization/deserialization steps for their subclass. Maybe this could be made more ergonomic by providing some infrastructure in Web IDL.
- https://webidl.spec.whatwg.org/#idl-exceptions will need some updating, e.g. change "eb IDL does not allow exceptions to be defined", and update various things that talk very specifically about DOMExceptions to also mention their subclasses.
- https://webidl.spec.whatwg.org/#es-creating-throwing-exceptions will need some updating to handle subclasses and come up with conventions for throwing them.
- Web IDL should provide some guidance for how to do this, especially e.g. on constructor signatures, and the interaction with the base class `name` field and argument.


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

Message ID: <whatwg/webidl/issues/1168/1183851493@github.com>

Received on Thursday, 14 July 2022 01:23:06 UTC