error-visualizer

1.2.1 • Public • Published

error-visualizer

An interactive and visually appealing error visualization tool for Node.js. Transform cryptic stack traces into colorful, ASCII art-enhanced displays with helpful tips and an interactive exploration mode.

Features

  • 🎨 Colorful error messages with ASCII art
  • 🔍 Interactive mode for exploring error details
  • 📊 Error statistics tracking
  • 🌈 Customizable color themes
  • 🌐 Global error handling for uncaught exceptions
  • 💡 Helpful tips for common error types

Installation

npm install error-visualizer

Usage

Basic Usage

const { visualizeError } = require('error-visualizer');

try {
  // Your code that might throw an error
  throw new Error('This is a test error');
} catch (error) {
  visualizeError(error);
}

Global Error Handling

const { setupGlobalErrorHandling } = require('error-visualizer');

// Set up global error handling
setupGlobalErrorHandling({ interactive: true });

// Your code here
// Any uncaught errors will be visualized

Interactive Mode

When using the interactive mode, you can:

  1. View the full stack trace
  2. See error statistics
  3. Change the color theme
  4. Exit the interactive mode

Customization

You can customize the appearance and behavior of the error visualizer:

const { visualizeError } = require('error-visualizer');

// Customize options
const options = {
  interactive: true, // Enable interactive mode
  theme: 'matrix', // Set initial color theme
};

visualizeError(error, options);

Acknowledgements

  • chalk for terminal string styling
  • boxen for creating boxes in the terminal

Happy debugging! 🐛🔍

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i error-visualizer

    Weekly Downloads

    5

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    7.52 kB

    Total Files

    3

    Last publish

    Collaborators

    • vanished01