kane-error

0.6.5 • Public • Published

Kane Error

Known Vulnerabilities

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-error

Usage

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.

Package Sidebar

Install

npm i kane-error

Weekly Downloads

0

Version

0.6.5

License

MIT

Unpacked Size

32.3 kB

Total Files

18

Last publish

Collaborators

  • nomad-education-developer