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

@wnodex/errors

v0.4.1

Published

Provides custom error classes and a centralized error handler for wnodex applications.

Readme

@wnodex/errors

wnodex custom application errors

Part of the wnodex ecosystem, this package provides custom error classes and a centralized error handler.

About

@wnodex/errors provides a structured approach to error handling in wnodex applications. It includes a set of custom error classes (HttpError, ConfigError, ValidationError) and a global error handling middleware that ensures consistent, predictable error responses.

Features

  • errorHandler middleware: A global error handler that catches exceptions and sends formatted JSON error responses.
  • HttpError class: For creating errors with a specific HTTP status code.
  • BaseError class: A base for creating custom, structured errors with codes and context.
  • ValidationError & ConfigError: Specialized error classes for common application failure scenarios.
  • Hides stack traces in production for security.

Why use it?

Structured error handling is crucial for building robust APIs. This package enforces a consistent error response format, making it easier for clients to handle errors. By using custom error classes, your application code becomes more expressive and easier todebug. The global handler prevents unhandled exceptions from crashing the server.

Installation

You can install the package using your favorite package manager:

pnpm

pnpm add @wnodex/errors

npm

npm install @wnodex/errors

yarn

yarn add @wnodex/errors

bun

bun add @wnodex/errors

Usage

The errorHandler middleware is automatically registered as the last middleware by wnodex, so there is no need to configure it. You can use the exported error classes throughout your application.

import { Wnodex } from 'wnodex';
import { HttpError } from '@wnodex/errors';

const server = new Wnodex({
  port: 3000,
});

const app = server.getApp();

app.get('/users/:id', (req, res) => {
  if (req.params.id === '0') {
    throw new HttpError('User not found', 404);
  }
  res.send({ id: req.params.id, name: 'John Doe' });
});

server.start();

// Request to /users/0 will result in a 404 response:
// {
//   "error": {
//     "message": "User not found"
//   }
// }

Custom Error Classes

  • HttpError(message, statusCode): Throws an error that results in a specific HTTP status.
  • ValidationError(message, cause, context): For data validation failures.
  • ConfigError(message, cause, context): For application configuration issues.

License

This project is licensed under the MIT License.

Copyright (c) 2026 Davide Di Criscito

For the full details, see the LICENSE file.