demo · v138

QuotaExceededError

Click "fill localStorage" to force a real QuotaExceededError, then inspect what you caught. In Chrome 138 it's a proper QuotaExceededError instance (still instanceof DOMException) with quota and requested properties — instead of the old indistinguishable generic.

checking support…

caught error

name message code constructor quota requested

instanceof checks

instanceof DOMException instanceof QuotaExceededError instanceof Error

In 138+ the typed catch becomes ergonomic.

the code

try {
  // Will throw in this browser when localStorage is full.
  localStorage.setItem("k", BIG_VALUE);
} catch (e) {
  if (e instanceof QuotaExceededError) {
    // 138+: a real subclass, with quota + requested
    console.log({ quota: e.quota, requested: e.requested });
  } else if (e?.name === "QuotaExceededError") {
    // Pre-138 fallback: detect by name on DOMException.
  }
}

see also