koan-errors
Version:
Koa.js error handling middleware
50 lines (33 loc) • 1.32 kB
Markdown
# Koa.js error handling middleware for Koan.js
[](https://travis-ci.org/koanjs/koan-errors)
[](https://gemnasium.com/bredikhin/koan-errors)
[](https://coveralls.io/r/bredikhin/koan-errors?branch=master)
[](http://badge.fury.io/js/koan-errors)
Based on [`koa-error`](https://github.com/koajs/error).
Supported content types:
- json
- html
## Installation
```js
$ npm install koan-errors
```
## Options
- `template`: path to template (defaults to the `errors.html` from the package),
- `engine`: templating engine to use (defaults to [`swig`](http://paularmstrong.github.io/swig/)).
## Custom templates
Following local variables are available within a custom template:
- `env`,
- `ctx`,
- `request`,
- `response`,
- `error`,
- `stack`,
- `status`,
- `code`.
## Contributions
* are welcome;
* should be tested;
* should follow [Koa.js](https://github.com/koajs/koa) coding style.
## License
[The MIT License](http://opensource.org/licenses/MIT)
Copyright (c) 2014 [Ruslan Bredikhin](http://ruslanbredikhin.com/)