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

error-overflow

v1.0.2

Published

Instantly translate cryptic Node.js errors into simple, actionable explanations for humans.

Readme

error-overflow

Errors for Humans, not Robots.

A lightweight, zero-dependency library that instantly translates cryptic Node.js errors into simple, actionable explanations with specific "Try this" fixes.

Table of Contents


Introduction

Node.js errors are often technical and focused on the stack trace rather than the solution. error-overflow intercepts these raw errors—such as MODULE_NOT_FOUND, EADDRINUSE, or confusing undefined property access—and converts them into a structured report.

It does not hide the original error; it augments it with context, probable causes, and suggested fixes.

Why Use This?

Standard Error Output:

Error: MODULE_NOT_FOUND
Error: Cannot find module 'axios'

With error-overflow:

Missing Module

What happened
Node.js could not find 'axios'.

Likely causes
- The package is not installed
- The path to the file is incorrect

Try this
- Run 'npm install axios'
- Check your package.json dependencies

Installation

Install the package via npm:

npm install error-overflow

Usage

The library exports two main functions: explainError for manual handling and initGlobalErrors for automatic handling.

Global Setup (Recommended)

Catch all unhandled errors automatically at the start of your application.

import { initGlobalErrors } from "error-overflow";

// Call this once at the top of your entry file
initGlobalErrors();

// Now any unhandled error will be explained automatically!
throw new Error("Something went wrong");

Manual Usage

Use explainError(error, context) to handle specific errors.

Basic Example

Wrap your error logging logic with explainError.

import { explainError } from "error-overflow";

try {
  await doSomethingRisky();
} catch (err) {
  // Pass the error object to get a formatted string
  console.log(explainError(err));
}

Advanced Example (Context)

You can pass a context object as the second argument. This allows the library to provide smarter suggestions, such as fuzzy matching for variable names.

const user = { name: "Alice" };

try {
  // Typo: 'usr' is not defined
  console.log(usr.name);
} catch (err) {
  // Pass available variables to help the matching algorithm
  console.log(explainError(err, { user }));
}

Architecture & Best Practices

Choose the right integration strategy for your application's needs.

1. Global Handler (initGlobalErrors)

Use Case: 🛑 CRASH & REPORT

Designed for catching unexpected, unrecoverable errors. It intercepts the crash, prints a human-readable report, and then cleanly exits the process.

Goal: Transform a cryptic stack trace into a helpful crash report.

graph LR
    A[Application Error] -->|Uncaught| B(Global Handler)
    B --> C{Analyzer}
    C -->|Match Found| D[Human Explanation]
    C -->|No Match| E[Generic Safety Report]
    D --> F((Process Exit 1))
    E --> F

2. Manual Handler (explainError)

Use Case: 🛡️ RECOVER & CONTINUE

Designed for expected errors where the application should stay alive (e.g., API failures, user input validation).

Goal: Gracefully handle errors without downtime.

try {
  await database.connect();
} catch (err) {
  console.error(explainError(err)); // Log and keep running
  retryConnection();
}

| Feature | Global Handler (initGlobalErrors) | Manual Handler (explainError) | | :----------- | :---------------------------------- | :--------------------------------- | | Trigger | Uncaught Exception / Rejection | catch (err) block | | Outcome | Logs explanation & Exits App | Returns string & Continues App | | Best For | Final safety net, CLI tools | Critical services, UI feedback | | Context | Limited (Global Scope) | Rich (Local Scope variables) |

Features

  • Missing Dependencies: Identifies missing packages and suggests installation commands.
  • Typos: Detects ReferenceErrors and suggests the correct variable name using fuzzy matching.
  • Missing Await: Detects attempts to access properties of a Promise that was not awaited.
  • Multi-Cause Analysis: Aggregates insights from multiple matching patterns when an error is ambiguous.
  • JSON Errors: Provides detailed explanations for parsing failures, such as trailing commas or missing quotes.
  • System Errors: Handles common system codes like EADDRINUSE (Port in use) and EACCES (Permission denied).

Safety & Stability

This library is designed to be crash-proof in production environments.

  1. Zero Throw Guarantee: The explainError function will never throw an exception.
  2. Fallback Mechanism: If an error cannot be matched to a known pattern, it falls back to a generic, safe explanation.
  3. Input Validation: All inputs are validated to ensure the error handler does not introduce new bugs.

License

ISC