Skip to content

Commit

Permalink
Fix rescue to run on the thread pool and handle non-exceptions
Browse files Browse the repository at this point in the history
I don't have a repo of the no exception but have seen this error in
testing:

```
exception class/object expected .rescue { |err| raise err } ^^^
```
  • Loading branch information
MattFenelon committed Sep 18, 2024
1 parent c356cc0 commit dcb437f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/graphiti/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ def future_resolve_sideloads(results)
end

Concurrent::Promises.zip_futures_on(self.class.global_thread_pool_executor, *sideload_promises)
.rescue { |err| raise err }
.rescue_on(self.class.global_thread_pool_executor) do |err|
if err.is_a?(Exception)
raise err
else
raise "Error resolving sideloads: #{err}"
end
end
end

def future_with_fiber_locals(*args)
Expand Down

0 comments on commit dcb437f

Please sign in to comment.