demo · v133

Error Type Matrix

Chrome 133 adds Error.isError(obj) — a reliable way to detect native JS errors and DOMExceptions that works across realms (iframes, workers, Proxy wrappers). This matrix runs all four detection approaches — Error.isError(), instanceof Error, duck typing (obj.message !== undefined), and Object.prototype.toString — across 15 different value types and shows where each approach fails.

Checking Error.isError() availability…
Value Error.isError() instanceof Error Duck type (.message) toString [object Error] Live result

Try any value type

Select a value and click Test.
// Chrome 133: Error.isError() — the reliable way
Error.isError(new Error("oops"))          // → true
Error.isError(new TypeError("x"))         // → true
Error.isError(new DOMException("x"))      // → true

// Failures that Error.isError() handles correctly:
// 1. Cross-realm errors (iframe, worker)
const iframeError = iframe.contentWindow.Error("cross");
instanceof Error           // → false (different realm!)
Error.isError(iframeError) // → true ✓

// 2. Proxy-wrapped errors
const proxied = new Proxy(new Error("x"), {});
instanceof Error           // → true (proxy is transparent)
// but duck-typing can be fooled by { message: "fake" }

// 3. DOMExceptions
const dom = new DOMException("x", "NotFoundError");
instanceof Error           // → false (DOMException ≠ Error)
Error.isError(dom)         // → true ✓

see also