Error Boundary
An enhanced React Error Boundary that captures breadcrumbs (actions leading to the error), generates fingerprints for grouping, and provides beautiful development-mode error UI.
Quick Setup
Wrap your application with the error boundary:
Configuration
| Prop | Type | Default | Description |
|---|---|---|---|
fallback |
ReactNode | ((error: EnhancedError) => ReactNode) |
Built-in UI | Custom error UI |
onError |
(error: EnhancedError) => void |
undefined |
Callback when error is caught |
maxBreadcrumbs |
number |
50 |
Maximum breadcrumbs to store |
showBreadcrumbs |
boolean |
true |
Show breadcrumbs in dev UI |
reportEndpoint |
string |
undefined |
POST endpoint for error reporting |
Breadcrumbs
Breadcrumbs capture user actions leading up to an error, providing context for debugging.
Automatic Tracking
Enable automatic click and fetch tracking:
Manual Breadcrumbs
Add custom breadcrumbs for important actions:
Breadcrumb Categories
| Category | Icon | Description |
|---|---|---|
log |
📝 | Log messages |
navigation |
🧭 | Route changes |
click |
👆 | User clicks |
input |
⌨️ | Form inputs |
fetch |
🌐 | API calls |
error |
❌ | Previous errors |
custom |
📌 | Custom events |
Error Fingerprinting
Fingerprints group similar errors together, useful for error aggregation:
Fingerprints are based on:
- Error type/name
- Normalized error message (UUIDs, IDs, URLs removed)
- Top stack frames (focusing on app code)
Stack Trace Parsing
Parse and format stack traces from any browser:
Enhanced Error Object
When an error is caught, the callback receives an enhanced error object:
Custom Fallback UI
Provide your own error UI:
Error Reporting
Send errors to your backend:
Error API Endpoint
Development vs Production
| Feature | Development | Production |
|---|---|---|
| Error UI | Rich overlay with stack | Simple "Something went wrong" |
| Breadcrumbs | Shown in overlay | Sent to reportEndpoint |
| Source Maps | Applied to stack | Use sourcemap service |
| Component Tree | Shown | Hidden |
Best Practices
1. Track Critical User Actions
Add breadcrumbs at key points in your app:
2. Use Multiple Boundaries
Wrap different sections for granular error handling:
3. Combine with Logging
Log errors along with catching them:
Next Steps
- Dev Overlay — See breadcrumbs in real-time
- Logging Basics — Log errors properly
- Error Handling — Error serialization