util.isError(object)
Stability: 0 - Deprecated
Returns true if the given "object" is an Error. Otherwise, returns false.
const util = require('util');
util.isError(new Error())
// true
util.isError(new TypeError())
// true
util.isError({ name: 'Error', message: 'an error occurred' })
// false
Note that this method relies on Object.prototype.toString() behavior. It is possible to obtain an incorrect result when the object argument manipulates @@toStringTag.
// This example requires the