# wrap-error-handler

> Utility used to catch unhandled exceptions in express route handlers

Latest version **1.0.0** (published 2018-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install wrap-error-handler
pnpm add wrap-error-handler
yarn add wrap-error-handler
bun add wrap-error-handler
```

## 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 | 1.0.0 |
| Published | 2018-04-25 |
| First published | 2018-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.11.1 |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | pooleparty |
| Maintainers | pooleparty |
| Keywords | express, error |

## Links

- npm: https://www.npmjs.com/package/wrap-error-handler
- Repository: https://github.com/pooleparty/wrap-error-handler
- Homepage: https://github.com/pooleparty/wrap-error-handler#readme
- Issues: https://github.com/pooleparty/wrap-error-handler/issues
- npm.io page: https://npm.io/package/wrap-error-handler

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

- 1.0.0 (latest) — 2018-04-25

## README

# wrap-error-handler

Utility used to catch unhandled exceptions in express route handlers

## Installation

Using npm:

```
npm install --save wrap-error-handler
```

## Usage

```js
import wrapErrorHandler from "wrap-error-handler";

function routeHandler(req, res, next) {
  const result = doSomethingThatMayThrowAnError();
  res.json(result);
}

const router = express.Router();

router.get('/', wrapErrorHandler(routeHandler));
```

## API

### wrapErrorHandler(fn)

#### fn

Type: `function`

Express handler function to wrap.

## Development

### Install dependencies

```
npm install
```

### Run linter

```
npm run lint
```

### Run tests

```
npm run tests
```

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