Normalize arbitrary thrown values into an Error instance used by the library.
Known Error instances with specific names are mapped to the library's
typed exceptions in order to preserve type information and any additional
fields (for example details, status, etc.). If the value is not an
Error it is converted to a generic Error containing the stringified value.
Parameters
error: unknown
The thrown value to normalize.
Returns Error
An Error instance representing the provided value.
Normalize arbitrary thrown values into an Error instance used by the library.
Known Error instances with specific names are mapped to the library's typed exceptions in order to preserve type information and any additional fields (for example
details,status, etc.). If the value is not an Error it is converted to a generic Error containing the stringified value.