instance method
handle
Ruby on Rails 7.0.10
Since v7.0.10Signature
handle(error_class = StandardError, severity: :warning, context: {}, fallback: nil)
Report any unhandled exception, and swallow it.
Rails.error.handle do 1 + '1' end
Parameters
-
error_classopt = StandardError -
severitykey = :warning -
contextkey = {} -
fallbackkey = nil
Source
# File activesupport/lib/active_support/error_reporter.rb, line 57
def handle(error_class = StandardError, severity: :warning, context: {}, fallback: nil)
yield
rescue error_class => error
report(error, handled: true, severity: severity, context: context)
fallback.call if fallback
end
Defined in activesupport/lib/active_support/error_reporter.rb line 57
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::ErrorReporter