Function isError

  • Checks if value is an Error object.

    Parameters

    • value: unknown

      The value to check.

    Returns value is Error

    Returns true if value is an Error object, false otherwise.

    console.log(isError(new Error())); // true
    console.log(isError('Error')); // false
    console.log(isError({ name: 'Error', message: '' })); // false