Module: ActiveSupport::Rescuable

Extended by:
Concern
Defined in:
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.



170
171
172
# File 'lib/active_support/rescuable.rb', line 170

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).



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

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