Provides error constructors with common HTTP status codes as numeric properties, supporting both Node.js and browser usage. Current stable version is 2.3.1 (last updated with dependency security patches). Release cadence is ad-hoc with occasional minor updates. Key differentiators: includes a stack-trace ponyfill for Safari compatibility, does not pollute stack depth, and offers detection via BaseError.isGenericError even after JSON serialization. Over 40 error types from 4xx and 5xx families are available.
npm install generic-errorsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows importing, throwing, catching, custom properties, and serialized detection.
Update imports: const errors = require('generic-errors'); const notFound = new errors.NotFound();Always use 'new errors.SomeError()'.
Use the built-in toJSON or implement your own serialization.
Do not rely on all listed codes being widely recognized.
Use: const errors = require('generic-errors'); const notFound = new errors.NotFound();Use named import: import { NotFound, BadRequest } from 'generic-errors';Always use 'new errors.NotFound()'.
No dependency data recorded yet.