Class: RailsErrorDashboard::ManualErrorReporter
- Inherits:
-
Object
- Object
- RailsErrorDashboard::ManualErrorReporter
- Defined in:
- lib/rails_error_dashboard/manual_error_reporter.rb
Overview
ManualErrorReporter: Report errors manually from frontend, mobile apps, or custom sources
This class provides a clean API for logging errors that don’t originate from Ruby exceptions, such as JavaScript errors from the frontend, mobile app crashes, or manually constructed errors.
Defined Under Namespace
Modules: ManualErrors Classes: SyntheticException
Class Method Summary collapse
-
.report(error_type:, message:, backtrace: nil, platform: nil, user_id: nil, request_url: nil, user_agent: nil, ip_address: nil, app_version: nil, metadata: nil, occurred_at: nil, severity: nil, source: nil) ⇒ ErrorLog?
Report a manual error to the dashboard.
Class Method Details
.report(error_type:, message:, backtrace: nil, platform: nil, user_id: nil, request_url: nil, user_agent: nil, ip_address: nil, app_version: nil, metadata: nil, occurred_at: nil, severity: nil, source: nil) ⇒ ErrorLog?
Report a manual error to the dashboard
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/rails_error_dashboard/manual_error_reporter.rb', line 71 def self.report( error_type:, message:, backtrace: nil, platform: nil, user_id: nil, request_url: nil, user_agent: nil, ip_address: nil, app_version: nil, metadata: nil, occurred_at: nil, severity: nil, source: nil ) # Create a synthetic exception object that quacks like a Ruby exception synthetic_exception = SyntheticException.new( error_type: error_type, message: , backtrace: normalize_backtrace(backtrace) ) # Build context hash for LogError context = { source: source || "manual", user_id: user_id, request_url: request_url, user_agent: user_agent, ip_address: ip_address, platform: platform, app_version: app_version, metadata: , occurred_at: occurred_at || Time.current, severity: severity }.compact # Remove nil values # Use the existing LogError command Commands::LogError.call(synthetic_exception, context) end |