JSPM

  • Created
  • Published
  • Downloads 9281
  • Score
    100M100P100Q13140F
  • License MIT

Common error types for feathers apps

Package Exports

  • feathers-errors

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (feathers-errors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

feathers-errors

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

Documentation

Current Error Types:

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

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

Usage:

import errors from 'feathers-errors';

let userService = {
  find(params, callback) {

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

    // You can also simply do something like this if you
    // just want to fire back a simple 500 error with your
    // custom message.
    // 
    // callback('A generic server error');
  }
};

Release History

1.0.0

  • converting to ES6
  • making structure consistent with other plugins
  • removing error handlers #11

0.2.0

  • Adding support for mongoose errors Issue #5.

0.1.4

  • Adding more error types
  • Changing missing to fourOhFour
  • Making library feathers core compatible

0.1.3

  • Adding a default error page

0.1.2

  • Minor bug fixes

0.1.1

  • Exposing error types directly via var types = require('feathers-errors').types;

0.1.0

  • Initial release

License

Copyright (c) 2015 Feathers Contributors

Licensed under the MIT license.