Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The Error.isError() static method determines whether the passed value is an Error.
The value to be checked.
true if value is an Error; otherwise, false.
Error.isError() checks if the passed value is an Error. It does so by performing a branded check for a private field initialized by the Error() constructor. This is the same mechanism used by Array.isArray(), which is in turn similar to the mechanism used by the in operator.
It is a more robust alternative to instanceof Error because it avoids false positives and false negatives:
Error.isError() returns true for DOMException instances. This is because, although DOMException is not specified as a real subclass of Error (the Error constructor is not the prototype of the DOMException constructor), DOMException still behaves like Error for all branded checking purposes.
When checking for Error instance, Error.isError() is preferred over instanceof because it works across realms.
You can use Error.isError() to detect if the caught value is an error and normalize it to an error object.
| ECMAScript® 2027 Language Specification # sec-error.iserror |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.