lib/active_support/rescuable.rb in activesupport-5.0.0.1 vs lib/active_support/rescuable.rb in activesupport-5.0.1.rc1
- old
+ new
@@ -86,10 +86,12 @@
# Returns the exception if it was handled and nil if it was not.
def rescue_with_handler(exception, object: self)
if handler = handler_for_rescue(exception, object: object)
handler.call exception
exception
+ elsif exception
+ rescue_with_handler(exception.cause, object: object)
end
end
def handler_for_rescue(exception, object: self) #:nodoc:
case rescuer = find_rescue_handler(exception)
@@ -119,10 +121,10 @@
if klass = constantize_rescue_handler_class(class_or_name)
klass === exception
end
end
- handler || find_rescue_handler(exception.cause)
+ handler
end
end
def constantize_rescue_handler_class(class_or_name)
case class_or_name