instance method
report
Ruby on Rails 7.0.10
Since v7.0.10Signature
report(error, handled:, severity: handled ? :warning : :error, context: {})
When the block based handle and record methods are not suitable, you can directly use report
Rails.error.report(error, handled: true)
Parameters
-
errorreq -
handledkeyreq -
severitykey = handled ? :warning : :error -
contextkey = {}
Source
# File activesupport/lib/active_support/error_reporter.rb, line 95
def report(error, handled:, severity: handled ? :warning : :error, context: {})
unless SEVERITIES.include?(severity)
raise ArgumentError, "severity must be one of #{SEVERITIES.map(&:inspect).join(", ")}, got: #{severity.inspect}"
end
full_context = ActiveSupport::ExecutionContext.to_h.merge(context)
@subscribers.each do |subscriber|
subscriber.report(error, handled: handled, severity: severity, context: full_context)
rescue => subscriber_error
if logger
logger.fatal(
"Error subscriber raised an error: #{subscriber_error.message} (#{subscriber_error.class})\n" +
subscriber_error.backtrace.join("\n")
)
else
raise
end
end
nil
end
Defined in activesupport/lib/active_support/error_reporter.rb line 95
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::ErrorReporter