Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feathers-errors

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-errors

Common error types for feathers apps

  • 1.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
decreased by-15.12%
Maintainers
2
Weekly downloads
 
Created
Source

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.

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
  • 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';

// 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'} });

Release History

1.2.0

  • Adding error handler and basic static error pages back in

1.1.2

  • Adding more tests
  • Adding even more flexibility for handling multiple errors

1.1.1

  • Fixing critical bug #15

1.1.0

  • Adding better support for multiple errors

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.

Keywords

FAQs

Package last updated on 24 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc