Skip to content

isError

Determine if a value is an Error

126 bytes

Usage

This function returns true if the input is an instance of the Error class or any of its subclasses.

import * as _ from 'radashi'
_.isError(new Error()) // => true
_.isError(new TypeError()) // => true
_.isError('An error occurred') // => false
_.isError({ message: 'Error' }) // => false