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 14, 2024 via pnpm

http-errors 2.0.0

Create HTTP error objects
Package summary
Share
0
issues
2
licenses
4
MIT
2
ISC
Package created
18 Nov 2012
Version published
18 Dec 2021
Maintainers
3
Total deps
6
Direct deps
5
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
4 Packages, Including:
depd@2.0.0
http-errors@2.0.0
statuses@2.0.1
toidentifier@1.0.1

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
inherits@2.0.4
setprototypeof@1.2.0
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

5
All Dependencies CSV
β“˜ This is a list of http-errors 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
depd2.0.08.18 kBMIT
prod
inherits2.0.41.98 kBISC
prod
setprototypeof1.2.01.92 kBISC
prod
statuses2.0.14.57 kBMIT
prod
toidentifier1.0.12.29 kBMIT
prod

Visualizations

Frequently Asked Questions

What does http-errors do?

The http-errors package is a valuable tool for creating HTTP errors with ease in applications that use Express, Koa, Connect, and similar frameworks. Conveniently accessible through the npm registry, this package works to streamline the creation of comprehensive error objects for HTTP transactions.

How do you use http-errors?

To utilize the http-errors package in your Node.js applications, first install the package using the command npm install http-errors. Once installed, you can require it in your application file. Here's an simple usage example:

var createError = require('http-errors');
var express = require('express');
var app = express();

app.use(function (req, res, next) {
  if (!req.user) return next(createError(401, 'Please login to view this page.'));
  next();
});

In the example above, if the user object is not available in the request, the middleware creates an HTTP 401 error using http-errors and passes it to the next middleware or the error handling middleware.

Moreover, with the http-errors package, you can either use status codes directly - as in createError(404, 'This video does not exist!') - or the constructor names, using camel case (i.e., new createError.NotFound()).

Where are the http-errors docs?

Comprehensive documentation for http-errors is provided directly in the README file in its GitHub repository at https://github.com/jshttp/http-errors. The document stipulates API details, usage examples, and an exhaustive list of status codes with their corresponding error constructor names in camel case. Whether you're looking to implement particular status codes or discern specific error properties, this documentation is a must-consult resource.