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

  1. 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.

  2. Storage-pressure dialog

    The user-facing payoff: a “free up N MB” prompt driven directly from the error’s quota and requested fields. No follow-up navigator.storage.estimate() needed.

  3. 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.

  4. Quota pressure lab

    Write localStorage chunks of adjustable size until a QuotaExceededError fires, then inspect the error's quota and requested fields (Chrome 138+). Tests all four catching patterns live — instanceof QuotaExceededError, name check, instanceof DOMException, and e.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

references