1.0.1 • Published 9 years ago

koa-errors v1.0.1

Weekly downloads
18
License
MIT
Repository
github
Last release
9 years ago

koa-errors

Koa middleware for displaying Rails-inspired error pages for development environments with error name, message, stack trace and extracted code around source of error.

Note: It does not swallow errors, they still get the same usual output in the console.

Tip: Looking for express version?

Installation

$ npm install koa-errors --save

Usage

var koa = require('koa');
var errors = require('koa-errors');

var app = koa();

app.use(errors());
app.use(function * (next) {
  throw new Error('Oh no, the world is coming to an end!');
  
  this.body = 'No way!';
  
  yield next;
});

app.listen(3000);

npm.io

License

koa-errors is released under the MIT license.