Class: RailsErrorDashboard::ErrorReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_error_dashboard/error_reporter.rb

Instance Method Summary collapse

Instance Method Details

#report(error, handled:, severity:, context:, source: nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rails_error_dashboard/error_reporter.rb', line 21

def report(error, handled:, severity:, context:, source: nil)
  # Skip low-severity warnings
  return if handled && severity == :warning

  # Extract context information
  error_context = ValueObjects::ErrorContext.new(context, source)

  # Log to our error dashboard using Command
  Commands::LogError.call(error, error_context.to_h.merge(source: source))
rescue => e
  # Don't let error logging cause more errors
  Rails.logger.error("ErrorReporter failed: #{e.message}")
end