dry-monads
dry-monads copied to clipboard
Do::Halt - use Exception instead of StandardError
Do::Halt
is a StandardError
. Because of that rescue block can unexpectedly catch it in a wrapped method. This problem has been reported at https://github.com/dry-rb/dry-monads/issues/72
If Do::Halt
was a direct Exception
derivative it would be nearly invisible to end-user.
Both ActiveRecord and Sequel catch Exception
. While this indeed is a breaking change it shouldn't affect majority of users.
In Discourse discussion we agreed that this breaking change will be included in some future major release.
What about using throw
/catch
instead?
@nixme using exceptions makes do notation transparent to transaction-like code (like one in AR and sequel), this is an important use case. We could have two versions of do notation with raise/rescue and throw/catch and let the user decide but that would be an overkill.