You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Andrea Gaertner 668e16c315 Einkaufsliste application_liste hinzugefügt 3 years ago
..
dist Einkaufsliste application_liste hinzugefügt 3 years ago
LICENSE Einkaufsliste application_liste hinzugefügt 3 years ago
README.md Einkaufsliste application_liste hinzugefügt 3 years ago
package.json Einkaufsliste application_liste hinzugefügt 3 years ago

README.md

Make Error Cause

NPM version NPM downloads Build status Test coverage

Make your own nested error types!

Features

  • Compatible with Node and browsers
  • Works with instanceof
  • Use error.stack and error.name
  • Output full cause with toString
  • Extends make-error

Installation

npm install make-error-cause --save

Usage

Usages from make-error. The only difference is that errors accept a second argument known as the error “cause”. The cause is used to wrap original errors with more intuitive feedback - for instance, wrapping a raw database error in a HTTP error.

const CustomError = makeErrorCause('CustomError')

const cause = new Error('boom!')
const error = new CustomError('something bad', cause)

error.toString() //=> "CustomError: something bad\nCaused by: boom!"
error.stack // Works!
error.cause.stack // Handy!

Attribution

Inspired by verror, and others, but created lighter and without core dependencies for browser usage.

License

Apache 2.0