Debug smarter, not harder! A developer-friendly error handling library that makes debugging enjoyable.
π Day 1 MVP Complete! Core error handling foundation with modular architecture
We believe error handling should be enjoyable, not frustrating! Debugg was created to solve the universal developer pain points:
- Inconsistent error handling across different parts of applications
- Lack of context when errors occur - making debugging difficult
- No standardized severity levels - hard to prioritize issues
- Multiple monitoring tools with different formats and APIs
- Cross-platform challenges - different error handling for browser vs Node.js
- Poor error tracking - no unique IDs to trace errors across systems
A single, unified library that provides:
- β Consistent error format across all platforms
- β Automatic error classification with severity levels
- β Rich context attachment for better debugging
- β Unique error IDs for tracking and correlation
- β Multiple reporter support (Sentry, webhooks, custom)
- β Cross-platform detection (browser, Node.js, mobile)
- β Type-safe API with comprehensive TypeScript support
- β Production-ready with minimal performance impact
# Using Bun (recommended)
bun add debugg
# Using npm
npm install debugg
# Using yarn
yarn add debuggπ― Day 1 MVP delivers a solid foundation with modular design:
src/
βββ types/ # Type definitions and interfaces
β βββ error.ts # Core type system
βββ utils/ # Utility functions
β βββ classify.ts # Advanced error classification
βββ core/ # Core functionality
β βββ capture.ts # Error capture and processing
βββ storage/ # Storage system
β βββ index.ts # In-memory storage with persistence
βββ index.ts # Main entry point
β Day 1 Features Implemented:
- Core error handling infrastructure
- Automatic error classification with severity levels
- Rich context support with depth limiting
- Cross-platform detection (browser, Node.js, mobile)
- Type-safe API with comprehensive TypeScript support
- Basic storage system with in-memory and localStorage options
- Multiple reporter support (console, Sentry, webhook)
- Performance-optimized design
import { ErrorHandler, createConsoleReporter } from 'debugg';
// π¨ Initialize Debugg with your brand personality
const debugg = new ErrorHandler({
serviceName: 'my-awesome-app',
environment: 'development',
defaultSeverity: 'medium',
logToConsole: true // See beautiful formatted errors!
});
// π Add reporters (Sentry, webhooks, or custom)
debugg.addReporter(createConsoleReporter());
// β¨ Handle errors anywhere with rich context
try {
await riskyDatabaseOperation();
} catch (error) {
await debugg.handle(error, {
// π‘ Add context for smarter debugging
userId: currentUser.id,
operation: 'update_profile',
database: 'postgresql',
query: 'UPDATE users SET name = $1 WHERE id = $2',
parameters: ['John Doe', currentUser.id]
});
}
// π― That's it! Enjoy beautiful, structured error handling!// Smart severity assignment - no more guessing!
debugg.handle(new TypeError('...')); // β 'high' severity
debugg.handle(new SyntaxError('...')); // β 'critical' severity
debugg.handle(new Error('Network error')); // β 'high' severity (auto-detected)
debugg.handle({ status: 500 }); // β 'critical' severity// Add unlimited context - Debugg handles the rest!
debugg.handle(error, {
user: { id: 123, email: 'user@example.com' },
request: { method: 'POST', endpoint: '/api/users' },
database: { query: 'SELECT * FROM users', timeout: 5000 },
// ... add anything that helps debugging!
});// Send errors everywhere with one line each!
debugg.addReporter(createSentryReporter('YOUR_DSN'));
debugg.addReporter(createWebhookReporter('https://api.example.com/errors'));
debugg.addReporter(yourCustomReporter);
// π All errors automatically sent to all reporters!Automatic platform detection - no configuration needed!
// Works everywhere automatically:
debugg.createError(new Error('test')).metadata.platform;
// Returns: 'browser' | 'node' | 'mobile' | 'unknown'- Browser: Includes user agent info
- Node.js: Detects Node.js environment
- Mobile: Identifies iOS/Android
- Unknown: Fallback for other environments
Full TypeScript support with comprehensive type definitions:
interface UniversalError extends Error {
severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
context: Record<string, any>;
timestamp: Date;
errorId: string;
metadata: {
platform: 'browser' | 'node' | 'mobile' | 'unknown';
serviceName: string;
environment: string;
// ... and more
};
}// Tailor Debugg to your exact needs
const debugg = new ErrorHandler({
serviceName: 'my-api-service',
environment: process.env.NODE_ENV || 'development',
defaultSeverity: 'medium',
logToConsole: true, // Beautiful console logging
includeStackTrace: true, // Helpful stack traces
maxContextDepth: 3, // Prevent memory issues
reporters: [ // Start with your reporters
createConsoleReporter(),
createSentryReporter('YOUR_DSN')
]
});// Build reporters for any service!
const myCustomReporter: ErrorReporter = async (error) => {
// Use Bun's native fetch for maximum performance!
await Bun.$fetch('https://my-error-service.com/api/errors', {
method: 'POST',
body: Bun.JSON.stringify(error),
headers: { 'Content-Type': 'application/json' }
});
};
debugg.addReporter(myCustomReporter);// Create structured errors for analytics, logging, etc.
const structuredError = debugg.createError(
new Error('Database timeout'),
{
database: 'postgresql',
query: 'SELECT * FROM users',
timeout: 5000,
affectedUsers: 150
},
'high' // Optional: override automatic severity
);
// Use in analytics, monitoring, or custom processing
analytics.track('error_occurred', structuredError);
monitoring.log(structuredError);
customProcessing(structuredError);import { createSentryReporter } from 'debugg';
debugg.addReporter(createSentryReporter('YOUR_SENTRY_DSN'));
// Automatically sends all errors to Sentry!import { createWebhookReporter } from 'debugg';
debugg.addReporter(createWebhookReporter('https://api.example.com/error-webhook'));
// POSTs all errors to your webhook endpoint!import { createConsoleReporter } from 'universal-error-handler';
debugg.addReporter(createConsoleReporter());
// Beautiful, structured console output!| Error Type | Severity | Description |
|---|---|---|
SyntaxError |
Critical | Code syntax issues |
TypeError |
High | Type-related errors |
ReferenceError |
High | Undefined variables |
RangeError |
Medium | Invalid ranges |
| Network errors | High | Connection issues |
| HTTP 5xx | Critical | Server errors |
| HTTP 4xx | Medium | Client errors |
| Default | Medium | Other errors |
- Saves time - No more writing custom error handling
- Reduces frustration - Makes debugging actually enjoyable
- Improves code quality - Consistent patterns across projects
- Better debugging - Rich context and structured data
- Easy integration - Works with your existing tools
- Standardized error handling - One solution for all apps
- Better production monitoring - Consistent error formats
- Faster issue resolution - Detailed context for every error
- Cross-platform consistency - Browser, Node.js, Mobile
- Reduced maintenance - Unified error reporting system
- Shows architectural thinking - Solves universal developer pain
- Demonstrates attention to detail - Comprehensive solution
- Proves production experience - Built for real-world use
- Highlights TypeScript expertise - Fully typed, modern API
- Shows innovation - "Debug smarter, not harder" approach
- Premium Reporters - Advanced integrations with monitoring services
- Cloud Service - Error aggregation and analytics dashboard
- Enterprise Features - Team collaboration, SLAs, advanced filtering
- Consulting Services - Help companies implement proper error handling
- Training & Certification - Error handling best practices
- High demand - Every company needs proper error handling
- Cross-industry applicability - Works for any JavaScript/TypeScript project
- Technical leadership - Shows you understand production systems
- Architectural skills - Demonstrates system design capabilities
- Problem-solving - Addresses a real pain point developers face daily
# Clone the repository
git clone https://github.com/your-repo/universal-error-handler.git
cd universal-error-handler
# Install dependencies (Bun recommended)
bun install
# Build the library
bun run build
# Run tests
bun test
# Start development mode
bun run devContributions are welcome! Please read our Contributing Guide for details on how to contribute.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the pain points of thousands of developers
- Built with love for the JavaScript/TypeScript community
- Designed to make error handling enjoyable (yes, really!)
Debugg is more than just a library - it's a developer experience revolution!
- Mascot: Debugg the Bug π - friendly, helpful, technical
- Mission: Make error handling enjoyable and empower developers
- Vision: Change how the industry thinks about error monitoring
- Colors: Vibrant red (#FF4757) for energy and action
- Typography: Inter for clean, modern readability
π₯ Ready to debug smarter? Install Debugg today!
bun add universal-error-handlerStar this repository if you love debugging again! β
π Explore our comprehensive documentation: