Nebo15 / sage

A dependency-free tool to run distributed transactions in Elixir, inspired by Sagas pattern.
MIT License
931 stars 41 forks source link

Fix catching exceptions in compensation actions #11

Closed take-five closed 6 years ago

take-five commented 6 years ago

Elixir encourages developers to use try .. rescue to catch exceptions instead of try ... catch :error, exception, because the latter form doesn't convert Erlang errors to Elixir exceptions.

For example, if compensation action contains a bug and calls non-existent module or function, then this error will be swallowed by function return_or_reraise, which will raise something like :undef.exception/1 is undefined and original exception will be lost.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling e8de6c8a68b7fd4133fee01d87e209c10f95770b on take-five:error-handling into 73a51d508b3bccaf009ad74347d09c930eeb8e50 on Nebo15:master.

AndrewDryga commented 6 years ago

Thanks @take-five 👍