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

💣 A base class for creating custom JavaScript error classes that wrap around a child error object.

License

Notifications You must be signed in to change notification settings

spudly/error-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

💣 A base class for creating custom JavaScript error classes that wrap around a child error object.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published