Skip to content

ErrorWrapper.create method

ErrorWrapper › create

Normalizes any thrown value to an Error.

Returns the value unchanged if it is already an Error, otherwise wraps it in an ErrorWrapper.

Signature:

create(thrownValue: unknown): Error

Parameters:

ParameterTypeDescription
thrownValueunknownThe thrown value to normalize.

Returns: ErrorAn Error instance: the original value if it is already an Error, otherwise an ErrorWrapper.