-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrapping the effect handler with a catch block #84
Comments
Possible workaround:
Although it would be better if this was handled inside of |
Any thoughts on this? as I would rather not use a rescue as it defeats the point of the efficiencies of using control flow over exceptions. A bit of context here, I am wrapping the |
I'm not sure if this is "fixable". It's certainly possible to emulate |
It seems as though a similar problem was fixed in this repo: https://github.com/rmosolgo/graphql-ruby/pull/3333/files But as you suggest if may not be possible from these discussions: and https://www.reddit.com/r/ruby/comments/l431j4/interesting_throwcatch_behaviour_in_ruby/ I would appreciate any help on this, as I have invested quite heavily into using dry-effects to provide a way to add dynamic scoping to the repository calls in hanami-rb. |
I have done some benchmarking, and it is not a disaster in terms of performance: https://gist.github.com/DangerDawson/9488598302a6d2ff9f2ea45912e5d4d7 Yielded these results:
So the slowdown is just under 4 fold. |
Issue when wrapping the effect handler with a catch block
Some libraries / frameworks like warden and hanami, use throw and catch to manage the flow of execution.
I am trying to use dry-effects to wrap all the call methods for hanami controller actions, although when a :halt is thrown instead of it being caught by the framework, it is being caught by dry-effects with the following error:
uncaught throw :error (UncaughtThrowError)
which is coming from:
lib/dry/effects/frame.rb:39:in
block in spawn_fiber'`To Reproduce
Expected behavior
I would expect dry-effects to ignore the specific throw and bubble it up
The text was updated successfully, but these errors were encountered: