1.0.7 • Published 4 years ago

koa-catcher v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

koa-catcher

Installation

npm install --save koa-catcher

Usage

This package captures errors in your api application (json) that other middlewares has not caught

We use console.info to show the errors if you pass debug as true

We emit the errors in case you want to listen them:

ctx.app.emit('error', error, ctx)

Example

const Koa = require('koa')
const catcher = require('koa-catcher')

const server = new Koa()

server.use(catcher()) // or server.use(catcher({ debug: true, message: 'Custom' }))

server.listen(3000)

Return

{ "message": "Internal Server Error" }

Author

Gideão Silva

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago