npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

koa-errors

1.0.1

@vdemedes

npmHomeRepoSnykSocket
Downloads:8
$ npm install koa-errors
DailyWeeklyMonthlyYearly

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);

License

koa-errors is released under the MIT license.