Checks if value is an Error object (including subclasses like TypeError). It does not treat the Error constructor itself as an instance. Since Lodash 0.1.0.
Pass the value you want to inspect or convert. Read the return type carefully before you use the result.
Syntax
Call _.isError. Start with this line.
Lodash
_.isError(value)
Call
What it does
_.isError(value)
Primary signature.
Prefer import isError from "lodash/isError" when you want a smaller bundle.
Library declarations
Lodash
_.isError(value)
Parameters
Parameter
Description
value
Required. The value to check
Return Value
Return Value
Description
*
true if Error object, else false
Lodash Examples
Example 1 — Official: Instance vs Constructor
Only Error instances pass — not the Error function.
Branch on whether the caught value is a real Error.
Lodash
function describe(err) {
if (_.isError(err)) {
return err.name + ": " + err.message;
}
return "non-error: " + String(err);
}
describe(new TypeError("x is not a function"));
// → "TypeError: x is not a function"
describe("boom");
// → "non-error: boom"
Use case. Logging and UI messages for mixed throw styles.
Compatibility
Browser & Runtime Support
_.isError is a Lodash Lang helper (since 0.1.0). It runs anywhere Lodash 4.x runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 0.1.0+
_.isError()
Available in [email protected] full builds and the lodash/isError modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
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
_.isErrorLodash 0.1.0+
Bottom line: Safe for production once Lodash is loaded. Prefer import isError from "lodash/isError". DOMException recognition applies in browser hosts that provide it.
Frequently Asked Questions
_.isError(value) returns true if value is classified as an Error object (including subclasses), otherwise false.
No. Error is the constructor function. Pass an instance: new Error("…").
Yes. Standard Error subclasses inherit Error tagging, so _.isError returns true.
No. Lodash looks for Error / DOMException tags — copying keys onto {} is not enough.
throw "oops" yields a string. _.isError returns false. Prefer throw new Error("oops").
Use import isError from "lodash/isError" or require("lodash/isError") for tree-shaking. Full build: import _ from "lodash" then _.isError.