diff options
Diffstat (limited to 'activesupport/lib/active_support/rescuable.rb')
-rw-r--r-- | activesupport/lib/active_support/rescuable.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index dc3f27a16d..ee6592fb5a 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -36,7 +36,7 @@ module ActiveSupport # render xml: exception, status: 500 # end # - # protected + # private # def deny_access # ... # end @@ -74,7 +74,7 @@ module ActiveSupport # # If no handler matches the exception, check for a handler matching the # (optional) exception.cause. If no handler matches the exception or its - # cause, this returns nil so you can deal with unhandled exceptions. + # cause, this returns +nil+, so you can deal with unhandled exceptions. # Be sure to re-raise unhandled exceptions if this is what you expect. # # begin @@ -83,11 +83,13 @@ module ActiveSupport # rescue_with_handler(exception) || raise # end # - # Returns the exception if it was handled and nil if it was not. + # 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 @@ -121,7 +123,7 @@ module ActiveSupport end end - handler || find_rescue_handler(exception.cause) + handler end end |