Re: [whatwg/webidl] Bikeshedding help needed for generic over-limit error (Issue #1463)

> Does it actually need to be a new type? Is there a reason not to just add more properties to the existing QuotaExceededError type? The usual thing in JS would be to have optional properties for when additional data is available (like how errors now all have an optional `cause`), rather than having different types.

The problem is that `"QuotaExceededError"` is just the value of the `name` property for certain `DOMException`s, due to `DOMException`'s unfortunate design. (Which mismatches the base JS language types). It doesn't have its own distinct type.

So if we want to add properties, our options are:

1. New subclass of `DOMException` (my proposal)
2. Conditionally add data properties to `DOMException` (maybe this is what you're suggesting?)
3. New error type that isn't a subclass of `DOMException`
4. Modify `DOMException` and have the getters return `undefined` most of the time

(2) and (3) require custom bindings, which web browser implementations are generally loathe to do. So we created the (1) path, with [first-class support in the spec](https://webidl.spec.whatwg.org/#idl-DOMException-derived-interfaces), since it seemed like the best we could do, and it paved a cowpath that at least two specs were already following.

If implementers think (2) is reasonable, maybe we could do that instead. I agree that not having two different types of "quota exceeded error"s in the platform is valuable.

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

Message ID: <whatwg/webidl/issues/1463/2611538559@github.com>

Received on Friday, 24 January 2025 04:21:55 UTC