https://github.com/btd/combined-error
Simple zero dependencies error for combining other errors, which ensures to have correct stack always
https://github.com/btd/combined-error
Last synced: 9 months ago
JSON representation
Simple zero dependencies error for combining other errors, which ensures to have correct stack always
- Host: GitHub
- URL: https://github.com/btd/combined-error
- Owner: btd
- License: mit
- Created: 2016-04-07T07:01:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-07T07:06:46.000Z (about 10 years ago)
- Last Synced: 2025-01-10T20:45:24.147Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CombinedError
Zero dependencies error that allow to combine other errors in cause chains.
This is useful if you want to save original errors from other modules.
## Example
var CE = require('combined-error');
var err1 = new CE(new Error('boom'), 'something bad 1');
console.log(err1.stack);
try {
try {
throw new Error('boom');
} catch(e) {
throw new CE(e, 'something bad 2');
}
} catch(e) {
console.log(e.stack);
}
## Browsers
Tested in FF, Safari, Chrome, i do not have ability to test IE and Edge.
## Node.js
Just require it.
## License
MIT