@feathersjs/errors
Common error types for feathers apps
Installation
npm install @feathersjs/errors --save
Quick usage:
const errors = require('@feathersjs/errors');
const notFound = new errors.NotFound('User does not exist');
const existing = new errors.GeneralError(new Error('I exist'));
const data = new errors.BadRequest('Invalid email', {
email: 'sergey@google.com'
});
const dataWithoutMessage = new errors.BadRequest({
email: 'sergey@google.com'
});
const validationErrors = new errors.BadRequest('Invalid Parameters', {
errors: { email: 'Email already taken' }
});
const validationErrors = new errors.BadRequest({
errors: {
email: 'Invalid Email'
}
});
Documentation
Please refer to the @feathersjs/errors API documentation for more details.
License
Copyright (c) 2018 Feathers Contributors
Licensed under the MIT license.