This document describes all error types that ActiveRabbit can capture, track, and monitor in Ruby on Rails applications.
| Category | Error Type | Example Scenario | Auto-Captured? | Priority | Notes |
|---|---|---|---|---|---|
| Basic Errors | StandardError | Unhandled exceptions in controllers/models | ✅ Yes | 🔴 Critical | Most common production error |
| Database | ActiveRecord::RecordNotFound | Missing database record (e.g., User.find(999)) | ✅ Yes | 🟡 Important | Common in production, often needs handling |
| Database | ActiveRecord::RecordInvalid | Validation failures with ! methods |
✅ Yes | 🟡 Important | Data integrity issues |
| Database | ActiveRecord::RecordNotUnique | Duplicate key violations | ✅ Yes | 🟡 Important | Constraint violations |
| Database | ActiveRecord::StatementInvalid | SQL errors, invalid queries | ✅ Yes | 🔴 Critical | Database schema issues |
| Controller | ActionController::BadRequest | Malformed requests | ✅ Yes | 🟢 Common | Client-side errors |
| Controller | ActionController::ParameterMissing | Required parameter missing | ✅ Yes | 🟢 Common | API parameter validation |
| Controller | ActionController::RoutingError | Route not found (404) | ✅ Yes* | 🟢 Common | *If ignore_404 = false |
| Controller | ActionController::UnknownFormat | Unsupported format requested | ✅ Yes | 🟢 Common | Format negotiation issues |
| Controller | ActionController::InvalidAuthenticityToken | CSRF token missing/invalid | ✅ Yes | 🟡 Important | Security-related |
| View/Template | ActionView::MissingTemplate | Template file not found | ✅ Yes | 🟡 Important | Deployment issues |
| View/Template | ActionView::Template::Error | Error during template rendering | ✅ Yes | 🟡 Important | ERB/Haml errors |
| View/Template | ActionView::TemplateError | Syntax errors in views | ✅ Yes | 🟡 Important | Code quality issues |
| JSON/API | JSON::ParserError | Malformed JSON in request | ✅ Yes | 🟢 Common | API client errors |
| JSON/API | MultiJson::ParseError | JSON parsing failures | ✅ Yes | 🟢 Common | API integration |
| Authentication | ActionController::InvalidAuthenticityToken | Missing CSRF token | ✅ Yes | 🟡 Important | Security monitoring |
| Network | Net::OpenTimeout | Connection timeout to external service | ✅ Yes | 🔴 Critical | External dependency issues |
| Network | Net::ReadTimeout | Read timeout from external service | ✅ Yes | 🔴 Critical | Performance degradation |
| Network | Errno::ECONNREFUSED | Connection refused to service | ✅ Yes | 🔴 Critical | Service unavailability |
| Background Jobs | Sidekiq errors | Job failures | ✅ Yes | 🟡 Important | Async processing issues |
| ActiveJob | ActiveJob::DeserializationError | Job argument deserialization fails | ✅ Yes | 🟡 Important | Background job issues |
| Custom | Any Ruby exception | Manual tracking via API | ✅ Yes | Varies | Full control over tracking |
- ✅ 100% Major Rails framework errors
- ✅ 100% Database/ActiveRecord errors
- ✅ 100% Controller/Action errors
- ✅ 100% View/Template errors
- ✅ 100% Security-related errors
- ✅ 100% Network/Timeout errors
- ✅ 100% Background job errors
- ✅ 100% Custom/Manual tracking
ActiveRabbit automatically subscribes to Rails' built-in error reporting:
Rails.error.subscribe(ActiveRabbit::ErrorReporter::Subscriber.new)Captures:
- All unhandled exceptions
- Exceptions reported via
Rails.error.report(exception) - Framework-level errors
ActiveRabbit includes multiple middleware layers:
# Error capture middleware (after Rails exception handlers)
ActiveRabbit::Middleware::ErrorCaptureMiddleware
# Request context tracking
ActiveRabbit::Client::RequestContextMiddleware
# Routing error catcher
ActiveRabbit::Client::RoutingErrorCatcherCaptures:
- Exceptions that bypass normal Rails handlers
- Routing errors (404s)
- Deep middleware-level errors
For background jobs:
Sidekiq.configure_server do |config|
config.error_handlers << ActiveRabbit::Client::SidekiqErrorHandler
endCaptures:
- Job execution failures
- Job deserialization errors
- Sidekiq worker crashes
For handled exceptions or custom scenarios:
begin
risky_operation
rescue => e
ActiveRabbit::Client.track_exception(e, context: {
user_id: current_user.id,
custom_data: "any metadata"
})
endActiveRabbit::Client.configure do |config|
config.ignored_exceptions = [
'ActiveRecord::RecordNotFound',
'ActionController::RoutingError',
'ActionController::InvalidAuthenticityToken'
]
endconfig.ignore_404 = true # Don't track 404s (recommended for production)
config.ignore_404 = false # Track all 404s (useful for monitoring)config.dedupe_window = 300 # Same error within 5 minutes = deduplicated
config.dedupe_window = 0 # Disable deduplication (report every occurrence)Every captured error includes:
- Exception class name
- Error message
- Full backtrace
- Occurred timestamp
- Environment (production/staging/development)
- HTTP method (GET, POST, etc.)
- Request path
- Controller and action
- Request parameters (PII-scrubbed)
- User agent
- IP address
- Ruby version
- Rails version
- Gem version
- Server name
- Release/deployment version
- Response time
- Database query count
- Memory usage (if available)
- GC statistics
Any additional metadata you provide via context: parameter
Errors are automatically grouped by:
- Exception class (e.g., StandardError, ActiveRecord::RecordNotFound)
- Error message (parameterized to group similar errors)
- Location (file and line number)
This allows you to see:
- How many times each unique error occurred
- Trends over time
- Which errors are most frequent
ActiveRabbit automatically scrubs sensitive data from:
- Request parameters
- Headers
- Error messages
- Backtraces
Default scrubbed fields:
config.pii_fields = [
'password', 'password_confirmation',
'token', 'secret', 'key',
'credit_card', 'ssn', 'social_security_number',
'phone', 'email',
'first_name', 'last_name', 'name',
'address', 'city', 'state', 'zip'
]Customize as needed:
config.pii_fields << 'custom_sensitive_field'Use our test Rails 8 application to verify all error types:
cd test_rails8_app
bundle exec rails server -p 3002
./test_all_errors.shSee test_rails8_app/README_TESTING.md for complete testing documentation.
- Latency: ~700ms per exception (sent immediately, not batched)
- Memory: Minimal overhead (~1-2MB for queue management)
- CPU: Negligible (<0.1% in production workloads)
- Errors sent asynchronously (doesn't block request)
- Automatic retry with exponential backoff
- Circuit breaker for API failures
-
Check gem version: Must be
>= 0.4.3gem 'activerabbit-ai', '~> 0.4.4'
-
Verify configuration:
ActiveRabbit::Client.configured? # Should return true
-
Check debug logs:
config.logger = Logger.new(Rails.root.join('log', 'activerabbit.log')) config.logger.level = Logger::DEBUG
-
Verify error reporter attached:
Rails.error.instance_variable_get(:@subscribers) # Should include ActiveRabbit::Client::ErrorReporter::Subscriber
Set dedupe_window = 0 in development:
if Rails.env.development?
config.dedupe_window = 0
endEnsure Sidekiq middleware is loaded:
# This should happen automatically, but verify:
Sidekiq.configure_server do |config|
# Should see ActiveRabbit error handler
endVersion: 0.4.4+ Last Updated: 2025-10-22 Status: ✅ Production Ready