v138 · javascript
Update QuotaExceededError to a DOMException derived interface
Currently, when the web platform wants to tell you when you've exceeded quota, it will use `DOMException` with the specific `name` property set to `QuotaExceededError`. However this does not allow carrying additional information. This proposes removing "QuotaExceededError" from the list of built-in `DOMException` names, and instead creates a class name `Q
concepts
-
QuotaExceededError as DOMException
QuotaExceededError is now a real DOMException-derived interface (with quota/requested fields), instead of a plain DOMException with a magic name string.
-
Storage-pressure dialog
The user-facing payoff: a “free up N MB” prompt driven directly from the error’s
quotaandrequestedfields. No follow-upnavigator.storage.estimate()needed. -
Error Catching Guide
Five catching patterns compared: name-string check, instanceof DOMException, instanceof QuotaExceededError (Chrome 138+), field access, and the recommended cross-browser safe pattern. Runs each one live and shows the result.
-
Quota pressure lab
Write localStorage chunks of adjustable size until a
QuotaExceededErrorfires, then inspect the error'squotaandrequestedfields (Chrome 138+). Tests all four catching patterns live —instanceof QuotaExceededError, name check,instanceof DOMException, ande.code === 22— with pass/fail badges.
why it shipped
Currently, when the web platform wants to tell you when you've exceeded quota, it will use `DOMException` with the specific `name` property set to `QuotaExceededError`. However this does not allow carrying additional information. This proposes removing "QuotaExceededError" from the list of built-in `DOMException` names, and instead creates a class name `Q