These are chat archives for dry-rb/chat

3rd
Sep 2018
Nazar Matus
@FunkyloverOne
Sep 03 2018 14:19
Hmmm, guys, now I think that handling Operation's exceptions on Transaction level is not quite good idea, because it makes that Transaction coupled with that only single Operation class, as it woks with exceptions of that particular Operation class, means it's kinda harder to "dependency-inject" something else there... Am I right?
So perhaps an Operation itself gotta be a bit smarter and able to handle it's exceptions on it's own. (If those exceptions are "third party", e.g. not defined in that Operation class, but are coming from some other class used inside Operation)
Nazar Matus
@FunkyloverOne
Sep 03 2018 14:26
I believe that Operation should rescue such expections and result with some sort of Failure monad, AND THEN Transaction will be working with more generic Failure instead of specific exception class... Yeah, I believe this "monadic" approach kinda replaces exceptions with Failures
Igor S. Morozov
@Morozzzko
Sep 03 2018 14:27

Yes, transactions are essentially about handling errors using types instead of exceptions.

Sure, any given operation may catch an exception and wrap it into a Failure, but still, it’s probably better to redesign your pipeline not to use exceptions at all.

Nazar Matus
@FunkyloverOne
Sep 03 2018 14:32
@Morozzzko sure, thanks, those aren't exceptions from any code I own, they are coming from third party API wrapper (koala gem actually), thanks for your reply!