Exposes HTTP error codes as Error constructors for Node.js. This package (v0.0.6, last updated in 2014) provides a simple way to create HTTP error objects with status codes (e.g., NotFound, InternalServerError). It is a lightweight alternative to packages like http-errors or boom, but with a smaller API surface and no dependency on Express. Currently in maintenance mode; no releases since 2014.
npm install http-errorVerified import paths — ran on the pinned version, not inferred.
Creates an HTTP error object with a status code and message. Demonstrates basic usage of the NotFound constructor.
Use require() instead of import.
Consider migrating to actively maintained alternatives like http-errors or http-assert.
Always use PascalCase constructors as defined in the README table (e.g., NotFound, InternalServerError).
Ensure you use PascalCase: new require('http-error').NotFound('msg')Use dynamic import or convert your project to CommonJS. Alternatively, use a wrapper module with createRequire.
No dependency data recorded yet.