coderef

Serializable errorsLimited availability

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().

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–76Not supported
77+Supportedsince Sep 10, 2019
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–102Not supported
103+Supportedsince Jul 26, 2022
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–76Not supported
77+Supportedsince Sep 10, 2019
Current: 155
Firefox Android
4–102Not supported
103+Supportedsince Jul 26, 2022
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Safari, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: Serializable object.

Feature detection

JS · check before using
if ("serializable_object" in Error || ("prototype" in Error && "serializable_object" in Error.prototype)) {
  // Error.serializable_object is available
}

Sub-features

Support for each part of the feature (8). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
DOMException.serializable_object7779101✕77101✕
Error.serializable_object7779103✕77103✕
EvalError.serializable_object7779103✕77103✕
RangeError.serializable_object7779103✕77103✕
ReferenceError.serializable_object7779103✕77103✕
SyntaxError.serializable_object7779103✕77103✕
TypeError.serializable_object7779103✕77103✕
URIError.serializable_object7779103✕77103✕