Open srghma opened 3 years ago
another example
output <- runEffect $ runWriter "" do
write "1"
catchDynE (\e -> write "error catched") do
write "2"
liftEffect $ throw $ error "myerror"
write "3"
write "4"
output `shouldEqual` "12error catched4"
I think some kind of function like this is useful, but what do you expect the type signature to be? Exceptions in PureScript and exceptions in Haskell are not the same.
Is this better handled at the lift layer?
liftAff' = rethrow <=< liftAff <<< attempt
I didnt find this function in https://hackage.haskell.org/package/freer
but it was in a paper "Freer Monads, More Extensible Effects" http://okmij.org/ftp/Haskell/extensible/more.pdf
it allows
catching IO exceptions in the presence of other effects
~current behaviour is~
~will throw runtime error "asdf" and the
{ result }
is not printed~~expected: replace
Run.catch
withRun.catchDynE
and catch the js error, print{ result }
and finish without error code~