isError
isError(
x
):x is Error
Checks if x
is classified as Error.
Example
isError(new Error("this is an error"))// => true
isError("foobar")// => false
Alternatives
- [Lodash - isError]https://lodash.com/docs/#isError)
Parameters
x
unknown
The value to check.
Returns
x is Error
true
if x
is an Error, false
otherwise.