npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

http-errors-plus

v1.0.3

Published

Next-gen HTTP error handling for modern JavaScript and TypeScript apps — structured, overrideable, and developer-focused.

Downloads

28

Readme

http-errors-plus

The next-generation HTTP error system for JavaScript & TypeScript — designed for modern DX, structured observability, and future-proof error handling.


⚡ Why http-errors-plus?

http-errors served us well — but it’s stuck in a CommonJS world with stringly-typed messages and zero structure and inspired me to do this.

http-errors-plus gives you:

✅ Fully ESM-ready and works in both JS and TS
✅ Named constants like NOT_FOUND, BAD_REQUEST, etc.
✅ Overrideable metadata: detail, path, traceId, requestId, etc.
✅ Drop-in generateError() utility
✅ Strong IntelliSense via JSDoc
HttpError class with .toJSON() and APM-ready structure


🚀 Installation

yarn add http-errors-plus

🧑‍💻 Usage

Import and Use Named Constants

import { BASE_HTTP_ERRORS, generateError } from 'http-errors-plus';

const { NOT_FOUND } = BASE_HTTP_ERRORS;

throw generateError(NOT_FOUND, {
  detail: 'User with ID 42 not found',
  path: '/api/users/42',
  requestId: 'req-xyz-123',
});

Output

{
  "status": 404,
  "code": "NOT_FOUND",
  "message": "Not Found",
  "detail": "User with ID 42 not found",
  "path": "/api/users/42",
  "timestamp": "2025-05-17T12:00:00Z",
  "requestId": "req-xyz-123"
}

📦 Exported API

✅ Constants

BASE_HTTP_ERRORS.NOT_FOUND      // { status: 404, code: 'NOT_FOUND', message: 'Not Found' }
BASE_HTTP_ERRORS.BAD_REQUEST    // { status: 400, code: 'BAD_REQUEST', message: 'Bad Request' }
// ... all standard HTTP codes covered

✅ generateError(base, overrides?)

Creates a new error object based on a constant.

const error = generateError(BASE_HTTP_ERRORS.CONFLICT, {
  detail: 'Email already exists',
  requestId: 'abc123',
});

✅ HttpError Class

new HttpError(403, {
  code: 'FORBIDDEN',
  message: 'Access denied',
  detail: 'Only admins can access this resource.',
})

🔍 Coming Soon

  • isHttpError() type guard
  • RFC 7807 .toProblemJSON() support
  • Built-in middleware for Express/Fastify
  • Auto-i18n key support

💡 Philosophy

HTTP errors should be:

  • Human-readable
  • Machine-parseable
  • Developer-first
  • Easy to maintain and override

🧠 Inspiration

Built as a modern successor to http-errors and statuses, with a fresh take on API dev ergonomics.


🪪 License

MIT — Use it, ship it, improve it.


✨ Author

Made by Mohamed Johnson. 🧠 Powered by clarity, DX obsession, and no chill mode.