New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

koa-err

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-err

Error handling middleware for koa

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

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

Keywords

koa

FAQs

Package last updated on 07 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts