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-lens

v1.0.2

Published

An advanced error logger with AI-powered insights and email notifications

Readme

Error Lens: Enterprise-Grade Error Intelligence Platform

Error Lens is an advanced error observability and analysis platform that leverages state-of-the-art AI models to provide real-time insights into application errors. By combining sophisticated error tracking with AI-powered analysis, it enables development teams to identify, understand, and resolve issues efficiently in both development and production environments.

Core Capabilities

  • AI-Powered Analysis Engine

    • Dual AI provider support (OpenAI GPT-4 / Google Gemini-Pro)
    • Contextual error pattern recognition
    • Intelligent root cause analysis
    • Code context evaluation using semantic embeddings
  • Advanced Error Telemetry

    • Real-time error capture and categorization
    • Structured error classification system
    • Comprehensive stack trace analysis
    • Context-aware error grouping
  • Enterprise Notification System

    • Configurable email notification pipeline
    • Severity-based alert routing
    • Rich error context in notifications
    • Customizable notification templates
  • Developer Experience

    • Rich console output with advanced formatting
    • Intuitive error boundary patterns
    • Flexible integration options
    • Minimal configuration overhead

Installation

npm install error-lens

Integration Guide

1. Platform Configuration

Initialize the Error Lens platform with your environment-specific configuration:

import { initializeConfig } from 'error-lens';

initializeConfig({
  // AI Provider Configuration
  openaiApiKey: process.env.OPENAI_API_KEY,      // Required for OpenAI integration
  googleApiKey: process.env.GOOGLE_API_KEY,      // Required for Google AI integration
  aiProvider: 'google',                          // AI provider selection ('google' | 'openai')

  // Notification Configuration
  resendApiKey: process.env.RESEND_API_KEY,      // Required for email notifications
  emailFrom: '[email protected]',      // Sender email address
  emailTo: '[email protected]',         // Recipient email address
});

2. Direct Error Logging Integration

Implement error logging with granular control over error handling behavior:

import { AIErrorLogger } from 'error-lens';

try {
  await performCriticalOperation();
} catch (error) {
  const logger = new AIErrorLogger();
  await logger.logError(error, {
    sendEmail: true,                    // Enable email notifications
    severity: 'error',                  // Set error severity ('error' | 'warning' | 'info')
    codeContext: 'Optional context'     // Provide additional context for AI analysis
  });
}

3. Higher-Order Error Boundary Pattern

Implement systematic error handling across function boundaries:

import { withErrorLogging } from 'error-lens';

// Define your business logic
const criticalOperation = async (params) => {
  // Your implementation
};

// Apply error boundary with custom configuration
const safeCriticalOperation = withErrorLogging(criticalOperation, {
  sendEmail: true,
  severity: 'error',
  metadata: {
    component: 'PaymentProcessor',
    priority: 'high'
  }
});

// Execute with error handling
await safeCriticalOperation(operationParams);

Advanced Configuration

Error Classification

Error Lens implements a sophisticated error classification system that automatically categorizes errors based on their type and context:

  • TypeError: Type-related runtime errors (e.g., attempting operations on incompatible types)
  • ReferenceError: Invalid reference access (e.g., accessing undefined variables)
  • SyntaxError: Code parsing failures (e.g., invalid JavaScript syntax)
  • RangeError: Out-of-bounds numerical operations (e.g., invalid array lengths)
  • URIError: URI encoding/decoding errors (e.g., malformed URI components)
  • EvalError: Errors occurring in eval() function execution
  • NetworkError: Communication failures (e.g., failed API requests, connection issues)
  • AggregateError: Multiple errors wrapped in a single error object
  • InternalError: JavaScript engine internal errors
  • WebAssemblyError: Errors in WebAssembly operations
  • AbortError: Operation cancellation errors (e.g., aborted fetch requests)
  • TimeoutError: Operation timeout errors (e.g., exceeded time limits)
  • SecurityError: Security violation errors (e.g., cross-origin violations)
  • ValidationError: Data validation failures (e.g., invalid input format)
  • DatabaseError: Database operation failures (e.g., connection errors, query failures)

Each error category is color-coded in the console output for quick identification. Unknown error types are automatically categorized as 'Unknown Error' for comprehensive error tracking.

AI Analysis Pipeline

The AI analysis pipeline provides multi-faceted error insights:

  1. Error Context Analysis: Evaluates the error in the context of your codebase
  2. Root Cause Identification: Determines the underlying cause of the error
  3. Solution Recommendations: Provides actionable fix suggestions
  4. Prevention Strategies: Offers long-term mitigation strategies

License

MIT License - See LICENSE file for details.


Error Lens is designed for development teams that require sophisticated error handling capabilities with AI-powered insights. While powerful, it should be integrated thoughtfully into your error handling strategy.