21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/rails_error_dashboard/error_reporter.rb', line 21
def report(error, handled:, severity:, context:, source: nil)
return if handled && severity == :warning
begin
error_context = ValueObjects::ErrorContext.new(context, source)
Commands::LogError.call(error, error_context.to_h.merge(source: source))
rescue => e
RailsErrorDashboard::Logger.error("[RailsErrorDashboard] ErrorReporter failed: #{e.class} - #{e.message}")
RailsErrorDashboard::Logger.error("Original error: #{error.class} - #{error.message}") if error
RailsErrorDashboard::Logger.error("Context: #{context.inspect}") if context
RailsErrorDashboard::Logger.error(e.backtrace&.first(5)&.join("\n")) if e.backtrace
nil end
end
|