Giter VIP home page Giter VIP logo

errors's Introduction

@feathersjs/errors

Greenkeeper badge

Build Status Test Coverage Dependency Status Download Status

Common error types for feathers apps

Installation

npm install @feathersjs/errors --save

Quick usage:

const errors = require('@feathersjs/errors');

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

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

// You can also pass additional data
const data = new errors.BadRequest('Invalid email', {
  email: '[email protected]'
});

// You can also pass additional data without a message
const dataWithoutMessage = new errors.BadRequest({
  email: '[email protected]'
});

// If you need to pass multiple errors
const 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
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.

errors's People

Contributors

ekryski avatar daffl avatar greenkeeper[bot] avatar corymsmith avatar greenkeeperio-bot avatar superbarne avatar kernelwhisperer avatar abraaoalves avatar kulakowka avatar franciscofsales avatar eirikfa avatar j2l4e avatar jasonmacgowan avatar jeremv42 avatar kamzil avatar coreh avatar marshallswain avatar nikaspran avatar designbyonyx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.