# koa-error-callback

> Error handling middleware for koa

Latest version **1.0.3** (published 2014-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-error-callback
pnpm add koa-error-callback
yarn add koa-error-callback
bun add koa-error-callback
```

## 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.3 |
| Published | 2014-10-17 |
| First published | 2014-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Christopher König |
| Maintainers | cking |
| Keywords | koa, error, handling, middleware |

## Links

- npm: https://www.npmjs.com/package/koa-error-callback
- Repository: https://github.com/ivpusic/koa-err
- Homepage: https://github.com/hovego/koa-error-callback
- Issues: https://github.com/hovego/koa-error-callback/issues
- npm.io page: https://npm.io/package/koa-error-callback

## 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.3 (latest) — 2014-10-17
- 1.0.2 — 2014-10-17
- 1.0.1 — 2014-10-14

## README

# koa-err

Error handling middleware for koa

### Installation
```
npm install koa-err
```

### Example

```
var koa = require('koa'),
  route = require('koa-route'),
  fs = require('co-fs'),
  koaErr = require('koa-err'),
  app = koa(),

app.use(koaErr());

app.use(route.get('/first', function * (next) {
  // some unhlandled generator error...
  var dummy = yield fs.readdir('someunknown');
  yield next;
}));
```

You will receive error with ``err.status`` or default ``500``, and ``err.message`` or default ``err``.

You can also define your own custom global error handler:
```
app.use(koaErr(function (err) {
  // some custom global handler logic...
}));
```

# License
MIT

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