This package (version 1.0.3) provides a simple factory function to create HTTP error objects with a given numeric status code. It was last released in an earlier era and is not actively maintained. The error object includes the code, standard HTTP message, and optional custom message or properties. It exposes `.toString()`, `.toJSON()`, and a `.codes` property. It only supports CommonJS (require) and is intended for Node.js environments. No releases have been made in years, and the package may be considered stable but deprecated in favor of more modern alternatives like 'http-errors' or 'http-errors-promise'. Usage with ESM (import) may fail without a wrapper.
npm install create-http-errorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creating HTTP errors with code, message, properties, and accessing status codes.
Switch to http-errors: const createError = require('http-errors'); createError(400);Always pass a number: HttpError(400).
Use CommonJS require() or wrap with createRequire.
Use const HttpError = require('create-http-error');Run npm install create-http-error --save
If using ES modules, use import HttpError from 'create-http-error' or switch to CommonJS.
No dependency data recorded yet.