QuotaExceededError
The error thrown when a write would take an origin over its storage quota.
In more detail
It is a DOMException, so check err.name to recognise it. localStorage.setItem throws it synchronously, so wrap writes in try...catch and degrade gracefully, for example by dropping old cached data.
Related terms
- storage quota — The maximum amount of data a browser lets one origin store.
- localStorage — A browser feature that saves small text values for a website so they are still there after the page is closed and reopened.
- try...catch — A statement that runs code in a try block and, if that code throws an exception, runs a catch block instead of crashing.
Taught in
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform