demo · v138

Storage-pressure dialog

The user-facing reason to bother promoting QuotaExceededError to a real interface: now you can write a meaningful “Free up N MB” dialog. The error’s quota and requested fields drive the prompt directly — no manual navigator.storage.estimate() follow-up.

180 MB
200 MB
180 / 200 MB (90%)

Storage almost full

To save your work we need a bit more space. Free up some cached items below.

the error shape

try {
  await idb.put(...);
} catch (e) {
  if (e instanceof QuotaExceededError) {       // NEW: real interface
    console.log(e.quota);                      // NEW: total bytes available
    console.log(e.requested);                  // NEW: bytes we tried to write
    showFreeUpDialog({
      shortBy: e.requested - e.quota,
    });
  }
}

Pre-138, the same error was a generic DOMException with name === "QuotaExceededError". To compose a meaningful UI you had to follow up with navigator.storage.estimate() and pray nothing else wrote between the two calls. The promotion to a derived interface makes the diagnostic data atomic with the throw.

see also