Error class
The JavaScript object that describes something going wrong, with a name such as TypeError and a human-readable message.
In more detail
Browsers throw specific kinds: TypeError when a Trusted Types check fails, DOMException named QuotaExceededError or AbortError for storage and cancellation. Checking err.name tells you which case you are handling.
Related terms
- 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.
- QuotaExceededError — The error thrown when a write would take an origin over its storage quota.
- instanceof — The JavaScript operator that checks whether an object was created by a given class, by walking its prototype chain.
- class — A blueprint in code that bundles data and the functions that work on it, from which objects are made.
Taught in
- Cancellation With AbortController And Async Signal Propagation — Frontend Architecture & Web Platform
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform
- Content Security Policy (CSP), Trusted Types And XSS Defenses — Frontend Architecture & Web Platform
- CSRF Mitigations, SameSite Cookies And Subresource Integrity — Frontend Architecture & Web Platform
- The in Operator And Instanceof Narrowing — Production TypeScript
- Assertion Signatures: asserts condition And Invariants — Production TypeScript
- Default Generic Arguments And Multi-Type Parameters — Production TypeScript
- The Spine Artifact: Generating Typed Models From OpenAPI — Production TypeScript