Module: ActiveSupport::Rescuable

Extended by:
Concern
Included in:
ActionController::Rescue, ActionController::StrongParameters, ActionMailer::Rescuable, ActiveJob::Execution
Defined in:
activesupport/lib/active_support/rescuable.rb

Overview

Rescuable module adds support for easier exception handling.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Concern

append_features, class_methods, extended, included

Instance Method Details

#handler_for_rescue(exception) ⇒ Object

Internal handler lookup. Delegates to class method. Some libraries call this directly, so keeping it around for compatibility.


163
164
165
# File 'activesupport/lib/active_support/rescuable.rb', line 163

def handler_for_rescue(exception) #:nodoc:
  self.class.handler_for_rescue exception, object: self
end

#rescue_with_handler(exception) ⇒ Object

Delegates to the class method, but uses the instance as the subject for rescue_from handlers (method calls, instance_exec blocks).


157
158
159
# File 'activesupport/lib/active_support/rescuable.rb', line 157

def rescue_with_handler(exception)
  self.class.rescue_with_handler exception, object: self
end