# @scienceai/create-error

> Create an instance of Error with a code property mostly from various CouchDB responses

Latest version **3.1.1** (published 2019-02-04) · AGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @scienceai/create-error
pnpm add @scienceai/create-error
yarn add @scienceai/create-error
bun add @scienceai/create-error
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2019-02-04 |
| First published | 2016-02-12 |
| Weekly downloads | 0 |
| License | AGPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 43.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sebastien Ballesteros |
| Maintainers | scienceai |
| Keywords | CouchDB, error |

## Links

- npm: https://www.npmjs.com/package/@scienceai/create-error
- Repository: https://github.com/scienceai/create-error
- Homepage: https://github.com/scienceai/create-error#readme
- Issues: https://github.com/scienceai/create-error/issues
- npm.io page: https://npm.io/package/@scienceai/create-error

## Dependencies (1)

- [http-status](https://npm.io/package/http-status.md) ^1.3.1

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

- 3.1.1 (latest) — 2019-02-04
- 3.1.0 — 2018-07-17
- 3.0.2 — 2017-08-22
- 3.0.0 — 2016-12-29
- 2.1.0 — 2016-12-05
- 2.0.0 — 2016-10-22
- 1.0.4 — 2016-05-10
- 1.0.3 — 2016-03-29
- 1.0.2 — 2016-03-29
- 1.0.1 — 2016-03-29
- 1.0.0 — 2016-02-25
- 0.0.0 — 2016-02-12

## README

# create-error

[![CircleCI](https://circleci.com/gh/scienceai/create-error.svg?style=svg&circle-token=9215b51dc17de650a6183a5bc3fe686b801f996c)](https://circleci.com/gh/scienceai/create-error)

[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

## Create an error with a code property

```js
import createError from '@scienceai/create-error';

createError();
createError(404);
createError('not found');
createError(404, 'not found');
```

## Automatically handle CouchDB and API responses (from request or XHR)

```js
import createError from '@scienceai/create-error';
import request from 'request';

request('http://example.com/couchdb', (err, resp, body) => {
  if (err = createError(err, resp, body)) {
    return callback(err);
  }

  // no error, we can process body
});
```

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