feathers-errors
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
: 400NotAuthenticated
: 401PaymentError
: 402Forbidden
: 403NotFound
: 404MethodNotAllowed
: 405NotAcceptable
: 406Timeout
: 408Conflict
: 409LengthRequired
: 411Unprocessable
: 422TooManyRequests
: 429GeneralError
: 500NotImplemented
: 501BadGateway
: 502Unavailable
: 503
Pro Tip: Feathers service adapters (ie. mongodb, memory, etc.) already emit the appropriate errors for you. :-)
Usage:
; // If you were to create an error yourself.var notFound = 'User does not exist'; // You can wrap existing errorsvar existing = 'I exist'; // You can also pass additional datavar data = 'Invalid email' email: 'sergey@google.com'; // You can also pass additional datavar dataWithoutMessage = email: 'sergey@google.com'; // If you need to pass multiple errorsvar validationErrors = 'Invalid Parameters' errors: email: 'Email already taken' ; // You can also omit the error message and we'll put in a default one for youvar validationErrors = errors: email: 'Invalid Email' ;
License
Copyright (c) 2016 Feathers Contributors
Licensed under the MIT license.