Look-alike object. Having name/message is not enough.
Best practice. Always throw new Error(…) (or a subclass).
Compatibility
Browser & Runtime Support
_.isError ships with Underscore.js 1.8.0+. It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.8+
_.isError()
Available in [email protected]+ (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.8+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.isErrorUnderscore 1.8+
Bottom line: Safe for production once Underscore 1.8+ is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.isError(object) returns true when the value inherits from Error — new Error(), new TypeError(), and other native Error subclasses. Numbers, null, strings, plain objects, and the Error constructor function return false.
The docs throw new TypeError("Example"), catch it, and call _.isError(o_O), which returns true. The catch value is a real Error instance.
Yes. EvalError, RangeError, ReferenceError, SyntaxError, TypeError, and URIError all return true, just like new Error().
No. JavaScript lets you throw any value. A caught string is still a string. Only Error objects pass.
typeof new Error() is "object", so typeof is too broad. instanceof Error usually agrees in the same window. Underscore uses the [object Error] tag, which is more consistent across iframes.
No. It is a stable Underscore helper added in version 1.8.0. Use it before reading name, message, or stack on a caught value.