Coerces an unknown value into a proper Error instance. Preserves the name, message, stack, and code if available.
The unknown error value
An Error instance
const err = asError('Something went wrong'); Copy
const err = asError('Something went wrong');
Coerces an unknown value into a proper Error instance. Preserves the name, message, stack, and code if available.