https://github.com/serviejs/servie-errorhandler
Map errors to a Servie response
https://github.com/serviejs/servie-errorhandler
error-handling errors http response servie status
Last synced: 24 days ago
JSON representation
Map errors to a Servie response
- Host: GitHub
- URL: https://github.com/serviejs/servie-errorhandler
- Owner: serviejs
- License: other
- Created: 2017-03-14T23:36:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-10T02:58:30.000Z (over 3 years ago)
- Last Synced: 2025-05-19T05:37:21.971Z (about 2 months ago)
- Topics: error-handling, errors, http, response, servie, status
- Language: TypeScript
- Size: 979 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Servie Errorhandler
[](https://npmjs.org/package/servie-errorhandler)
[](https://npmjs.org/package/servie-errorhandler)
[](https://travis-ci.org/serviejs/servie-errorhandler)
[](https://coveralls.io/r/serviejs/servie-errorhandler?branch=master)> Map errors to a Servie response. Compatible with [`boom`](https://github.com/hapijs/boom) and [`http-errors`](https://github.com/jshttp/http-errors).
## Installation
```
npm install servie-errorhandler --save
```## Usage
```ts
import { Request } from "servie";
import { finalhandler } from "servie-finalhandler";
import { errorhandler } from "servie-errorhandler";const app = compose([get(), post()]);
const req = new Request("/");app(req, finalhandler(req)).catch(errorhandler(req));
```## TypeScript
This project is written using [TypeScript](https://github.com/Microsoft/TypeScript) and publishes the definitions directly to NPM.
## License
Apache 2.0