Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Latest commit

 

History

History
48 lines (32 loc) · 1.38 KB

README.md

File metadata and controls

48 lines (32 loc) · 1.38 KB

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...

NPM

Build Status

js-semistandard-style

Dependencies DevDependencies

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