Limited supportLimited support. Check browser compatibility before use.

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
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 3 item(s)
Implementation note
  • 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()`).
Notes 3 item(s)
Implementation note
  • 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()`).
Notes 3 item(s)
Implementation note
  • 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()`).
Notes 3 item(s)
Implementation note
  • 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()`).
Notes 3 item(s)
Implementation note
  • 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()`).
Notes 3 item(s)
Implementation note
  • 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()`).
Notes 3 item(s)
Implementation note
  • 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

JAVASCRIPT
// Serializable errors example
// See MDN Web Docs for details

Live demo

Error serialize

Error object dei-pcopi-possible. with structuredClone

PreviewFullscreen

Errorturn with Worker between.

Error by thread to Submit in. with postMessage

PreviewFullscreen

Support Error type

Error, TypeError, RangeError equal also serializepossible.

PreviewFullscreen

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.

Powered by web-features