3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/eras/error_reporter.rb', line 3
def report(error, handled:, severity:, context:, source: nil)
return if Eras.config.ignored_error_classes.include?(error.class.name)
return unless Eras.config.reporting_envs.include?(::Rails.env)
context = context.merge(rails_env: ::Rails.env).transform_values(&:to_s)
kaller = caller
data = {
handled: handled,
severity: severity,
context: context,
source: source
}.tap do |d|
d[:error] = if error.is_a?(Exception)
{
title: error.class.name,
message: error.message,
backtrace: error.backtrace&.join("\n")
}
else
{
title: "[message]",
message: error,
backtrace: cleaner.clean(kaller).join("\n")
}
end
end
Eras.adapter.write_error(data)
end
|