# feathers-errors

> Common error types for feathers apps

Latest version **2.9.2** (published 2017-09-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install feathers-errors
pnpm add feathers-errors
yarn add feathers-errors
bun add feathers-errors
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.9.2 |
| Published | 2017-09-05 |
| First published | 2014-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 4 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Feathers contributors |
| Maintainers | daffl, ekryski |
| Keywords | feathers, feathers-plugin, feathers-errors |

## Links

- npm: https://www.npmjs.com/package/feathers-errors
- Repository: https://github.com/feathersjs/feathers-errors
- Issues: https://github.com/feathersjs/feathers-errors/issues
- npm.io page: https://npm.io/package/feathers-errors

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^3.0.0

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 2.9.2 (latest) — 2017-09-05
- 2.9.1 — 2017-07-21
- 2.9.0 — 2017-07-20
- 2.8.2 — 2017-07-05
- 2.8.1 — 2017-05-30
- 2.8.0 — 2017-05-08
- 2.7.1 — 2017-04-28
- 2.7.0 — 2017-04-25
- 2.6.3 — 2017-04-08
- 2.6.2 — 2017-03-16
- 2.6.1 — 2017-03-06
- 2.6.0 — 2017-03-04
- 2.5.0 — 2016-11-04
- 2.4.0 — 2016-07-17
- 2.3.0 — 2016-07-10
- … 32 more at https://npm.io/package/feathers-errors/versions

## README

# feathers-errors

[![Greenkeeper badge](https://badges.greenkeeper.io/feathersjs/feathers-errors.svg)](https://greenkeeper.io/)

[![Build Status](https://travis-ci.org/feathersjs/feathers-errors.png?branch=master)](https://travis-ci.org/feathersjs/feathers-errors)
[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-errors.png)](https://codeclimate.com/github/feathersjs/feathers-errors)
[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-errors/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-errors/coverage)
[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-errors.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-errors)
[![Download Status](https://img.shields.io/npm/dm/feathers-errors.svg?style=flat-square)](https://www.npmjs.com/package/feathers-errors)
[![Slack Status](http://slack.feathersjs.com/badge.svg)](http://slack.feathersjs.com)

> 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:

```bash
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
* `LengthRequired`: 411
* `Unprocessable`: 422
* `TooManyRequests`: 429
* `GeneralError`: 500
* `NotImplemented`: 501
* `BadGateway`: 502
* `Unavailable`: 503

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

#### Usage:

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

## License

Copyright (c) 2016 Feathers Contributors

Licensed under the [MIT license](LICENSE).

---
_Source: https://npm.io/package/feathers-errors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
