Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 16, 2024 via pnpm

errorhandler 1.4.3

Development-only error handler middleware
Package summary
Share
0
issues
1
license
6
MIT
Package created
3 Mar 2014
Version published
18 Jan 2016
Maintainers
5
Total deps
6
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
6 Packages, Including:
accepts@1.3.8
errorhandler@1.4.3
escape-html@1.0.3
mime-db@1.52.0
mime-types@2.1.35
negotiator@0.6.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of errorhandler 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
accepts1.3.85.28 kBMIT
prod
escape-html1.0.31.87 kBMIT
prod

Visualizations

Frequently Asked Questions

What does errorhandler do?

Errorhandler is a development-only error handler middleware for Node.js applications. It serves the purpose of providing complete information about errors during the development process. The middleware sends full error stack traces and internal details of any object passed to it when an error occurs back to the client. Content negotiation is used to return the error details in HTML, JSON, or plain text formats, depending on the type of object that caused the error.

How do you use errorhandler?

Errorhandler can be easily used in your Node.js or Express.js application. First, download and install the Errorhandler module from the npm registry using the following command:

$ npm install errorhandler

After successful installation, you can import Errorhandler into your application using the require function:

var errorhandler = require('errorhandler')

After importing you can use it as middleware in your application like this:

var express = require('express')
var errorhandler = require('errorhandler')

var app = express()

if (process.env.NODE_ENV === 'development') {
  // only use in development
  app.use(errorhandler())
}

You can further customize Errorhandler by passing in an options object. For example, if you want to output the errors to a different location during development other than the standard error output:

var express = require('express')
var errorhandler = require('errorhandler')
var notifier = require('node-notifier')

var app = express()

if (process.env.NODE_ENV === 'development') {
  // only use in development
  app.use(errorhandler({ log: errorNotification }))
}

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

  notifier.notify({
    title: title,
    message: str
  })
}

Where are the errorhandler docs?

For in-depth knowledge of how to use Errorhandler, the complete documentation is provided on the official Google source code errorhandler GitHub repository. The repository contains information on installation instructions, API usage, custom configurations, and sample examples. Browsing through the README file on this repository will provide a solid understanding of how to use and implement errorhandler in your Node.js applications for more efficient error handling during the development process.