Nanoscale Parts Manufacturing

    @salsita/koa-error-middleware

    1.1.2 • Public • Published

    @salsita/koa-error-middleware

    NPM version Downloads Licence Dependency Status devDependency Status

    Top level middleware for catching and displaying errors (assumes using error classes from @salsita/errors).

    Expects logging function as parameter.

    Example:

    const winston = require("winston");
    const Router = require("koa-router");
    const errorMiddleware = require("@salsita/koa-error-middleware");
    
    const formatUserMessage = err =>
      process.env.NODE_ENV === "production" ? "Ooops something went wrong" : err.message;
    
    const router = new Router();
    router.use(errorMiddleware(winston.log, formatUserMessage));

    Keywords

    none

    Install

    npm i @salsita/koa-error-middleware

    DownloadsWeekly Downloads

    5

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    2.47 kB

    Total Files

    3

    Last publish

    Collaborators

    • goce
    • salsita-npm
    • littlewhywhat