Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

feathers-errors

feathersjs12.6kMITdeprecated2.9.2TypeScript support: included

Feathers v3 is out and has moved to @feathersjs/errors. See https://docs.feathersjs.com/migrating.html for more information.

Common error types for feathers apps

feathers, feathers-plugin, feathers-errors

readme

feathers-errors

Greenkeeper badge

Build Status Code Climate Test Coverage Dependency Status Download Status Slack Status

Common error types for feathers apps

Getting Started

Feathers errors come with feathers by default. So typically you don't need to install it at all.

In the event that you do need to install it:

npm install --save feathers-errors

Documentation

Current Error Types:

  • BadRequest: 400
  • NotAuthenticated: 401
  • PaymentError: 402
  • Forbidden: 403
  • NotFound: 404
  • MethodNotAllowed: 405
  • NotAcceptable: 406
  • Timeout: 408
  • Conflict: 409
  • LengthRequired: 411
  • Unprocessable: 422
  • TooManyRequests: 429
  • GeneralError: 500
  • NotImplemented: 501
  • BadGateway: 502
  • Unavailable: 503

Pro Tip: Feathers service adapters (ie. mongodb, memory, etc.) already emit the appropriate errors for you. :-)

Usage:

import errors from 'feathers-errors';

// If you were to create an error yourself.
var notFound = new errors.NotFound('User does not exist');

// You can wrap existing errors
var existing = new errors.GeneralError(new Error('I exist'));

// You can also pass additional data
var data = new errors.BadRequest('Invalid email', {email: 'sergey@google.com'});

// You can also pass additional data
var dataWithoutMessage = new errors.BadRequest({email: 'sergey@google.com'});

// If you need to pass multiple errors
var validationErrors = new errors.BadRequest('Invalid Parameters', {errors: {email: 'Email already taken'} });

// You can also omit the error message and we'll put in a default one for you
var validationErrors = new errors.BadRequest({errors: {email: 'Invalid Email'} });

License

Copyright (c) 2016 Feathers Contributors

Licensed under the MIT license.

changelog

Change Log

v2.9.1 (2017-07-21)

Full Changelog

Merged pull requests:

  • Add back default error message #83 (daffl)

v2.9.0 (2017-07-20)

Full Changelog

Closed issues:

  • Wrong stack for errors #78

Merged pull requests:

v2.8.2 (2017-07-05)

Full Changelog

Merged pull requests:

  • Fix wildcard import on ES2015+ #80 (coreh)
  • Add more information to error debug #79 (kamzil)

v2.8.1 (2017-05-30)

Full Changelog

Merged pull requests:

v2.8.0 (2017-05-08)

Full Changelog

Closed issues:

  • Support array objects as data #64

Merged pull requests:

v2.7.1 (2017-04-28)

Full Changelog

Closed issues:

  • Object.setPrototypeOf in IE 10 #70

Merged pull requests:

  • Define property toJSON because just assigning it throws an error in N… #74 (daffl)

v2.7.0 (2017-04-25)

Full Changelog

Merged pull requests:

v2.6.3 (2017-04-08)

Full Changelog

Closed issues:

  • Make options the same as res.format #37

Merged pull requests:

  • fix typescript definitions with noImplicitAny #69 (JVirant)

v2.6.2 (2017-03-16)

Full Changelog

Closed issues:

  • Create a TokenExpired error type #53

Merged pull requests:

  • Fix declarations for index.d.ts #66 (ghost)

v2.6.1 (2017-03-06)

Full Changelog

Merged pull requests:

v2.6.0 (2017-03-04)

Full Changelog

Closed issues:

  • Full Validation Error Object not passed to client promise #61
  • More HTTP Statuses #48

Merged pull requests:

v2.5.0 (2016-11-04)

Full Changelog

Closed issues:

  • Possible issue with Node 4 #51
  • Consider using restify/errors as base #31

Merged pull requests:

v2.4.0 (2016-07-17)

Full Changelog

Merged pull requests:

  • adding ability to get a feathers error by http status code #46 (ekryski)

v2.3.0 (2016-07-10)

Full Changelog

Closed issues:

  • Heroku error Reflect.construct #44

Merged pull requests:

v2.2.0 (2016-05-27)

Full Changelog

Closed issues:

  • Can not format error to json #35

Merged pull requests:

v2.1.0 (2016-04-03)

Full Changelog

Closed issues:

  • Support passing a custom html format function #32

Merged pull requests:

v2.0.2 (2016-03-23)

Full Changelog

Closed issues:

  • ReferenceError: Reflect is not defined #29
  • Make error pages opt-in #24

Merged pull requests:

v2.0.1 (2016-02-24)

Full Changelog

Closed issues:

  • Error handler is wrapping errors as GeneralErrors #27

Merged pull requests:

v2.0.0 (2016-02-24)

Full Changelog

Merged pull requests:

v1.2.4 (2016-02-24)

Full Changelog

v1.2.3 (2016-02-21)

Full Changelog

Merged pull requests:

  • Adding default error page and make HTML formatting optional #25 (daffl)

v1.2.2 (2016-02-18)

Full Changelog

Closed issues:

  • Add error handler back #21

Merged pull requests:

  • Make fully CommonJS compatible and add error middleware tests #23 (daffl)

v1.2.1 (2016-02-16)

Full Changelog

v1.2.0 (2016-02-15)

Full Changelog

Closed issues:

  • Check to make sure that errors propagate via web sockets #1

Merged pull requests:

v1.1.6 (2016-01-12)

Full Changelog

Closed issues:

  • stacktraces are incorrect when used in an ES6 app #20
  • We shouldn't mutate the error object passed in. #19
  • only one instance of babel-polyfill is allowed #17

v1.1.5 (2015-12-18)

Full Changelog

v1.1.4 (2015-12-15)

Full Changelog

Closed issues:

  • no method 'setPrototypeOf' in Node 0.10 #16

v1.1.3 (2015-12-15)

Full Changelog

v1.1.2 (2015-12-15)

Full Changelog

Closed issues:

  • Passing errors as second argument #9

v1.1.1 (2015-12-14)

Full Changelog

Closed issues:

  • Subclassing Errors using babel don't behave as expected #14

Merged pull requests:

v1.1.0 (2015-12-12)

Full Changelog

v1.0.0 (2015-12-12)

Full Changelog

Closed issues:

  • Convert to ES6 #12
  • Drop the error handlers: Breaking Change #11
  • Remove Lodash dependency #10
  • Logging only unhandled errors #8

Merged pull requests:

  • complete rewrite. Closes #11 and #12. #13 (ekryski)

0.2.5 (2015-02-05)

Full Changelog

0.2.4 (2015-02-05)

Full Changelog

0.2.3 (2015-01-29)

Full Changelog

0.2.2 (2015-01-29)

Full Changelog

0.2.1 (2014-09-03)

Full Changelog

0.2.0 (2014-07-17)

Full Changelog

Implemented enhancements:

  • Handle error objects with an 'errors' object #5

0.1.7 (2014-07-06)

Full Changelog

0.1.6 (2014-07-05)

Full Changelog

0.1.5 (2014-06-13)

Full Changelog

0.1.4 (2014-06-13)

Full Changelog

Closed issues:

  • Move errors into core #2

Merged pull requests:

0.1.3 (2014-06-09)

Full Changelog

Merged pull requests:

0.1.2 (2014-06-05)

Full Changelog

0.1.1 (2014-06-04)

Full Changelog

v0.1.0 (2014-06-04)

* This Change Log was automatically generated by github_changelog_generator