Serializable errors
The DOMException, Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, and URIError objects are serializable. You can call structuredClone() on an error object or pass it to a worker using postMessage().
Overview
The DOMException, Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, and URIError objects are serializable. You can call structuredClone() on an error object or pass it to a worker using postMessage().
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
api.DOMException.serializable_object | 77 | 79 | 101 | | 77 | |
| Built-in object | ||||||
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
| Serializable objects are objects that can be serialized and later deserialized in any JavaScript environment ("realm"). This allows them to, for example, be stored on disk and later restored, or cloned with Window.structuredClone, or shared between workers using DedicatedWorkerGlobalScope.postMessage(). | 77 | 79 | 103 | | 77 | |
- Version 103 serialized properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 adds serialization of `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 adds serialization of `stack` in workers (`worker.postMessage()` and `structuredClone()`).
- Version 103 serializable properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 also serializes `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 also serializes `stack` in workers (`worker.postMessage()` and `structuredClone()`).
- Version 103 serializable properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 also serializes `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 also serializes `stack` in workers (`worker.postMessage()` and `structuredClone()`).
- Version 103 serializable properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 also serializes `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 also serializes `stack` in workers (`worker.postMessage()` and `structuredClone()`).
- Version 103 serializable properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 also serializes `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 also serializes `stack` in workers (`worker.postMessage()` and `structuredClone()`).
- Version 103 serializable properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 also serializes `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 also serializes `stack` in workers (`worker.postMessage()` and `structuredClone()`).
- Version 103 serializable properties: `name`, `message`, `cause`, `fileName`, `lineNumber` and `columnNumber`.
- Version 104 also serializes `stack` in the main thread (`window.postMessage()` and `structuredClone()`).
- Version 110 also serializes `stack` in workers (`worker.postMessage()` and `structuredClone()`).
Syntax
// Serializable errors example
// See MDN Web Docs for details Live demo
Use cases
Using Serializable errors
The DOMException, Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, and URIError objects are serializable. You can call structuredClone() on an error object or pass it to a worker using postMessage().
Cautions
- Limited browser support. Check compatibility before use.
Accessibility
- When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.
Related links
Powered by web-features