koa-handle-error
Error handler Middleware for Koa@2.x
Installation
npm install koa-handle-error
Usage
IMPORTANT: handleError
must register first as Koa middleware!
const Koa = ;const handleError = ;const app = ; const onError = { console;}; app; // must register first!app;app;
API
handleError(onError: Function): (context: Koa.Context, next: () => Promise) => void
Returns a Koa middleware.
onError
will called with the error when some error occured.