error-wrapper
v2.1.0
Published
A base class for errors that wrap other errors.
Downloads
6
Readme
ErrorWrapper
A Base Class for creating error objects that wrap around other error objects without trashing the stack trace of the original error. Stack traces will appear in the following format:
ERROR MyCustomErrorWrapper Some Error Message
at /path/to/some/js/file.js:123:456
at /path/to/some/other/js/file.js:123:456
...
Caused By: Error: Some Other Error Message
at /path/to/some/js/file.js:123:456
at /path/to/some/other/js/file.js:123:456
All the Badges...
Usage
import ErrorWrapper from 'error-wrapper';
class MyErrorWrapper extends ErrorWrapper {
// Add extra properties/methods if desired:
get code() {
return 'MYERRORWRAPPER';
}
}
// later...
throw new MyErrorWrapper('error message', originalError);
License
MIT