• Asserts that the given error is an instance of the Error class. If the error is an instance of Error, it is returned. If the error is not an instance of Error, a new Error object is created with a descriptive message.

    Parameters

    • error: unknown

      The error to be asserted.

    Returns Error

    • The error if it is an instance of Error, or a new Error object if it is not.

    IMPORTANT: no sensitive data should be passed as any parameter.