Wraps an error in a custom error type.
The custom error type that extends Error.
The error to wrap.
The constructor of the error class to use.
An instance of the custom error type with the original message and stack trace.
try { // ...} catch (err) { throw errorAs(err, TypeError); // throws TypeError} Copy
try { // ...} catch (err) { throw errorAs(err, TypeError); // throws TypeError}
v0.3.0
Wraps an error in a custom error type.