Default error handlers
Closed this issue · 4 comments
Once any IO
inside Scenario.eval()
fails with some exception an application halts.
Can we implement a way of handling such exceptions inside scenarios? For example it would be useful to convert such handled exceptions into human-readable message.
@augustjune, I can help implementing new features.
Hi, thank you for your involvement.
I know this issue can be annoying (and dangerous) and actually I am working on this right now.
More specifically, I am thinking about providing MonadError
instance for Scenario
for F
which are capable of error handling (which are most of the IO types people use). This is not complicated from the implementation point, but I have to consider the implications this will bring for Scenario
type.
Just finished the PR #59
Going to add a couple more enhancements and release it with v0.2.0
With 0.2.0 release, new methods for error handling were added to Scenario
.
You can use handleErrorWith
and attempt
directly on your scenario now in order to handle potential errors.
Additionally, there's MonadError
instance for Scenario
if you use it with effect-like F
, so you have access to other methods like recover
.