Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 8 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 (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-10T02:58:30.000Z (about 3 years ago)
- Last Synced: 2024-12-11T16:51:09.862Z (24 days ago)
- Topics: error-handling, errors, http, response, servie, status
- Language: TypeScript
- Size: 979 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Servie Errorhandler
[![NPM version](https://img.shields.io/npm/v/servie-errorhandler.svg?style=flat)](https://npmjs.org/package/servie-errorhandler)
[![NPM downloads](https://img.shields.io/npm/dm/servie-errorhandler.svg?style=flat)](https://npmjs.org/package/servie-errorhandler)
[![Build status](https://img.shields.io/travis/serviejs/servie-errorhandler.svg?style=flat)](https://travis-ci.org/serviejs/servie-errorhandler)
[![Test coverage](https://img.shields.io/coveralls/serviejs/servie-errorhandler.svg?style=flat)](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