Get or create an error from the given value, if it's not an error, it will be wrapped in an UnknownError.
Error instance or error message.
Error instance.
UnknownError
v0.1.0
try { // ...} catch (err) { console.log(toError(err).message);} Copy
try { // ...} catch (err) { console.log(toError(err).message);}
Get or create an error from the given value, if it's not an error, it will be wrapped in an UnknownError.