Error.isError()
The Error.isError() static method determines whether the passed value is an Error.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 134 | 134 | 138 | 18.4 | 134 | 18.4 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 2 item(s)
Limitation
- This browser only partially implements this feature
Implementation note
- Returns `false` for `DOMException` instances.
Notes 2 item(s)
Limitation
- This browser only partially implements this feature
Implementation note
- Returns `false` for `DOMException` instances.
Syntax
JAVASCRIPT
Error.isError(new Error('test')); // true
Error.isError(new TypeError()); // true
Error.isError({ message: 'fake' }); // false Live demo
Check native Error objects
Use Error.isError when available, otherwise fall back to instanceof Error.
JavaScript
Output
Press the Run button
Inspect different thrown values
Compare errors, strings, and plain objects with the same helper.
JavaScript
Output
Press the Run button
Use inside catch handling
Normalize catch blocks that may receive non-Error values.
JavaScript
Output
Press the Run button
Use cases
-
Shared error pipelines
Normalize error handling in utilities that may receive thrown values from different execution contexts.
-
Runtime guards
Distinguish real Error objects from arbitrary thrown values before formatting or reporting them.
Cautions
- A reliable error check still does not guarantee the value contains the information your UI needs.
- Thrown strings and custom objects remain possible, so keep fallback handling in place.
Accessibility
- Reliable error detection helps ensure users receive consistent failure messages and recovery options.
- Error handling only improves accessibility if the resulting UI feedback is perceivable and actionable.