# flora-errors

> Error definitions for Flora

Latest version **2.1.0** (published 2021-11-24) · MIT license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2021-11-24 |
| First published | 2015-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | BörseGo AG |
| Maintainers | not-implemented, riplexus, nicokaiser, mbaumgartl |

## Links

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

## Recent versions

- 2.1.0 (latest) — 2021-11-24
- 2.0.0 — 2019-06-26
- 2.0.0-alpha.2 — 2019-02-14
- 2.0.0-alpha.1 — 2018-11-29
- 0.9.1 — 2018-11-27
- 0.9.0 — 2018-10-30
- 0.8.0 — 2018-03-21
- 0.7.1 — 2017-06-06
- 0.7.0 — 2017-01-03
- 0.6.0 — 2016-03-15
- 0.2.0 — 2015-07-10

## README

# flora-errors

![](https://github.com/godmodelabs/flora-errors/workflows/ci/badge.svg)
[![NPM version](https://img.shields.io/npm/v/flora-errors.svg?style=flat)](https://www.npmjs.com/package/flora-errors)
[![NPM downloads](https://img.shields.io/npm/dm/flora-errors.svg?style=flat)](https://www.npmjs.com/package/flora-errors)

Error definitions for [Flora](https://github.com/godmodelabs/flora).

This module exposes error classes for different types of errors to be able to determine whether an error should be displayed to the client (such as AuthenticationError) or not (internal errors).

To be able to pass through the error type to clients, a `code` property is also set. The default error codes are listed below.

## Error classes

### RequestError

- Generic request error (the user made an invalid request)
- HTTP status code `400`, the `message` will be displayed
- Error code is `ERR_REQUEST_ERROR`

### AuthenticationError

- The user is either not authenticated, or the credentials are wrong
- HTTP status code `401`
- Error code is `ERR_AUTHENTICATION_ERROR`

### AuthorizationError

- The user may be authenticated, but is not authorized for the requested action
- HTTP status code `403`
- Error code is `ERR_AUTHORIZATION_ERROR`

### NotFoundError

- Either the requested resource could not be found, or a specific entity of the resource.
- HTTP status code `404`, `message` will be displayed
- Error code is `ERR_NOT_FOUND`

### GoneError

- The requested resource is gone, e.g. was deleted
- HTTP status code `410`, `message` will be displayed
- Error code is `ERR_GONE`

### ImplementationError

- There is a problem with the implementation, e.g. of one of the resources. This should not happen
- HTTP status code `500`
- Error code is `ERR_IMPLEMENTATION_ERROR`

### DataError

- There is a problem with the data retrieved by one of the data sources
- HTTP status code `500`
- Error code is `ERR_DATA_ERROR`

### ConnectionError

- There is a problem with the connection to a data source. May work on retry (e.g. temporary network problems)
- HTTP status code `503`.
- Error code is `ERR_CONNECTION_ERROR`

### ValidationError

- There is a problem validating input data. This is a special case of `RequestError`
- HTTP status code `400`
- Error code is `ERR_VALIDATION_ERROR`
- Second parameter of constructor will be added as additional `validation` property.

## License

[MIT](LICENSE)

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