Module: ActiveSupport::Rescuable

Extended by:
Concern
Defined in:
lib/active_support/rescuable.rb

Overview

Active Support Rescuable

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, prepend_features, prepended

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.



172
173
174
# File 'lib/active_support/rescuable.rb', line 172

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



166
167
168
# File 'lib/active_support/rescuable.rb', line 166

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