Skip to content

Commit

Permalink
Refactored the rescuing of the exception to make it more elegant
Browse files Browse the repository at this point in the history
  • Loading branch information
adviti-mishra committed Jul 17, 2024
1 parent dd7c35b commit 005c5b4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/mongoid/interceptable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,10 @@ def _mongoid_run_child_callbacks_with_around(kind, children: nil, &block)

block&.call

fibers.reverse.each do |fiber|
begin
fiber.resume
rescue FiberError
raise Mongoid::Errors::InvalidAroundCallback
end
end
fibers.reverse.each(&:resume)

rescue FiberError
raise Mongoid::Errors::InvalidAroundCallback
end

# Execute the callbacks of given kind for embedded documents without
Expand Down

0 comments on commit 005c5b4

Please sign in to comment.