Skip to content

sankety/lite-http-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published