Skip to content

rankmyapp/error-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI

error-handler

Technologies

  • Node.js;
  • Sentry.

This lib was made to handle errors and log them somewhere Currently you can use it as a Node.js middleware. The errorHandler function accepts a list of error codes it should filter from being sent to sentry according to err status code. As a middleware it will log the error and call next(err):

const errorHandler = require('error-handler');
app.use(errorHandler({ blockEvents: [404, 403, 401] }).middleware);

or

Use it just as a function to log something logError accepts a string origin (from where the error comes) and err object or message:

const errorHandler = require('error-handler');
errorHandler().logError(origin, err);

Testing

Jest was used to test this lib, run it with:

yarn test

About

Sentry error handler

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 8