lite-http-error

1.0.0 • Public • Published

Lite HTTP Error ⛵

A minimalist error class for nodeJS

Getting Started

  • Install the package npm i lite-http-error
  • Then use it like any Error in JS but with Http Status code as second param.
  import HttpError from 'lite-http-error';

   if(thisIsMistake){
    throw new HttpError('Some dreadful message' , 500);
   }
  • Next add a middleware (if in express) it will catch this error and do the needful.

Refrence from Daniel Wagener's Blog

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i lite-http-error

      Weekly Downloads

      1

      Version

      1.0.0

      License

      ISC

      Unpacked Size

      1.46 kB

      Total Files

      3

      Last publish

      Collaborators

      • yewalesanket