Skip to content

Commit dd39506

Browse files
authored
Merge pull request rails#55435 from byroot/rescue-from-namespace
Fix ActiveSupport::Rescuable not to be coupled with ActionController
2 parents ece7201 + 19dcdbd commit dd39506

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

actionpack/lib/action_controller/metal/rescue.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ module Rescue
1313
extend ActiveSupport::Concern
1414
include ActiveSupport::Rescuable
1515

16+
module ClassMethods
17+
def handler_for_rescue(exception, ...) # :nodoc:
18+
if handler = super
19+
ActiveSupport::Notifications.instrument("rescue_from_callback.action_controller", exception: exception)
20+
handler
21+
end
22+
end
23+
end
24+
1625
# Override this method if you want to customize when detailed exceptions must be
1726
# shown. This method is only called when `consider_all_requests_local` is
1827
# `false`. By default, it returns `false`, but someone may set it to

activesupport/lib/active_support/rescuable.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def rescue_with_handler(exception, object: self, visited_exceptions: [])
9292

9393
if handler = handler_for_rescue(exception, object: object)
9494
handler.call exception
95-
ActiveSupport::Notifications.instrument("rescue_from_callback.action_controller", exception: exception)
9695
exception
9796
elsif exception
9897
if visited_exceptions.include?(exception.cause)

0 commit comments

Comments
 (0)