Make Error Cause
Make your own nested errors.
Features
- Compatible with node.js and browsers
- Works with
instanceof
- Automatic full stack traces in node.js (supports
inspect()
) - Output full stack trace with
fullStack(err)
- Extends
make-error
Installation
npm install make-error-cause --save
Usage
; { supermessage cause; } const error = "Boom!";const customError = "Another boom!" error; console; // Automatically prints full stack trace using `fullStack(this)`.console; // Check causes via the `.cause` property. console; //=> true
Attribution
Inspired by verror
, and others, but created lighter and without core dependencies for browser usage.
Other references:
License
Apache 2.0