Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

errorhandler

Package Overview
Dependencies
Maintainers
6
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

errorhandler

Development-only error handler middleware

  • 1.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-3.31%
Maintainers
6
Weekly downloads
 
Created

What is errorhandler?

The errorhandler npm package is an error handler middleware for use with Express.js applications. It provides full stack traces and error message responses for errors during development, and a minimal response not leaking internal information in production.

What are errorhandler's main functionalities?

Development Error Handling

In a development environment, errorhandler can provide detailed stack traces and error messages to the console and the client, helping developers debug issues.

app.use(errorhandler({ log: errorNotification }))

function errorNotification(err, str, req) {
  var title = 'Error in ' + req.method + ' ' + req.url;
  console.error(title, str);
}

Production Error Handling

In a production environment, errorhandler can be used to send a generic error message to the client, without leaking sensitive stack trace information.

if (process.env.NODE_ENV === 'production') {
  app.use(errorhandler());
}

Other packages similar to errorhandler

FAQs

Package last updated on 09 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc