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

@vsaas/error-handler

v11.0.6

Published

Fork of StrongLoop's strong-error-handler for @vsaas LoopBack projects, providing enhanced error handling and response formatting capabilities

Downloads

1,022

Readme

@vsaas/error-handler

HTTP error writer for Express and LoopBack 3 style applications.

@vsaas/error-handler is a fork of strong-error-handler. The goal of this fork is to stay compatible with the original package for the common LoopBack 3 / Strong Remoting use cases, while making the codebase smaller and easier to maintain.

Compared with the upstream package, this fork intentionally removes a number of legacy concerns:

  • TypeScript source with build output in dist/
  • English-only messages
  • No i18n catalogs or strong-globalize
  • Several legacy files and dependencies removed
  • Modern tooling with tsdown, vitest, and oxlint

The public behavior is still meant to be familiar for applications that already depended on strong-error-handler, but the internals were simplified on purpose to reduce maintenance overhead.

Installation

npm install @vsaas/error-handler

Usage

Express middleware

const express = require('express');
const errorHandler = require('@vsaas/error-handler');

const app = express();

app.use(
  errorHandler({
    debug: process.env.NODE_ENV !== 'production',
    log: true,
  }),
);

Direct response writer

const errorHandler = require('@vsaas/error-handler');

errorHandler.writeErrorToResponse(new Error('something went wrong'), req, res, {
  debug: false,
});

Response formats

The handler supports:

  • application/json / json
  • text/html / html
  • text/xml / xml

Content type is negotiated from the request Accept header. You can also override it with the _format query parameter.

Options

| Option | Default | Description | | ---------------------- | --------- | --------------------------------------------------------------------------- | | debug | false | Include full error details and stack traces in responses. | | log | true | Log errors to console.error. | | safeFields | [] | Extra error properties allowed through for safe responses. | | defaultType | "json" | Fallback response type when negotiation does not resolve one. | | rootProperty | "error" | Root property for JSON/XML responses. Use false to omit the JSON wrapper. | | negotiateContentType | true | When false, always use defaultType unless _format overrides it. |

Behavior

  • 4xx responses keep safe client-facing fields such as message, details, and code.
  • 5xx responses are sanitized by default to avoid leaking internals.
  • When debug: true, the full error payload is returned.

Development

npm run build
npm run typecheck
npm run lint
npm test

License

MIT. See LICENSE.md.