0.6.5 • Published 7 years ago
kane-error v0.6.5
Kane Error
Error handler for the Kane API.
Requirements
You need to execute node version 8.x at least (async/await).
Installation
# npm
npm install --save kane-error
# yarn
yarn add kane-errorUsage
Koa middleware
A simple error handler that log unhandled exceptions and send a standard "message" back to the user:
const Koa = require("koa");
const {koaErrorHandler} = require("kane-error");
const app = new Koa();
app.use(koaErrorHandler());Koa Custom Error
This is an utility object that incorporate the HTTP status to send back to the user:
const {KaneError} = require("kane-error");
throw new KaneError(418, "I'm a teapot!");Linting
Made using eslint. To enforce rules to be applied, use yarn lint:fix.