pretty-error-classes

1.0.0 • Public • Published

Pretty Error Classes

Build Status

Allows you to dynamically create error classes, with an elegant API.

const { ValidationError } = require('pretty-error-classes')

try {
  throw new ValidationError('meow')
} catch (e) {
  if (e instanceof ValidationError) {
    console.log('validation error') // gets here
  } else {
    console.log('generic catching') // does not get here
  }
}

Package Sidebar

Install

npm i pretty-error-classes

Weekly Downloads

4

Version

1.0.0

License

Unlicense

Last publish

Collaborators

  • mxbaylee