Re: [whatwg/webidl] Upgrade QuotaExceededError to a DOMException derived interface (PR #1465)

domenic left a comment (whatwg/webidl#1465)

In particular, note that there's not really a clean way to set the code:

- If we add it to the predefined error names table, then `(new DOMException("message", "QuotaExceededError")).code` will be nonzero, which is misleading, since after this change, it's more correct for that to behave like `(new DOMException("message", "asdf")).code` and return 0.

- If we add a `code` getter to `QuotaExceededError` itself, that adds an extra own property to the prototype chain, shadowing the one in `DOMException`, which is observably different and confusing.

- So we'd have to do something like... branching on whether `this` is a `QuotaExceededError` inside the `code` getter of `DOMException`? Which is not great layering.

Overall I'm concerned about the precedent here saying that we need to preserve the code, instead of letting `DOMException`-derived interfaces behave cleanly, disconnected from the legacy `code` infrastructure. (Which we don't even use for new `DOMException`s, much less new `DOMException`-derived interfaces.)

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

Message ID: <whatwg/webidl/pull/1465/c3088233448@github.com>

Received on Friday, 18 July 2025 08:08:30 UTC