Kanaka-io / play-monadic-actions

A simple scala DSL to allow clean and monadic style for Play! Actions
Other
128 stars 29 forks source link

Recommended way to recover from failed futures #39

Closed mrwillis closed 6 years ago

mrwillis commented 6 years ago

Thanks for this library. Really saved me from the pyramid of doom.

How can I recover from failed futures along the for comprehension? For instance, suppose the first future in the comprehension throws an exception. I want this to fail the whole comprehension but I also want to handle the specific exception and return an appropriate InternalServerError or whatever it may be.

Thanks!

mrwillis commented 6 years ago

Figured it out. I tried to recover the comprehension but realized I was missing parentheses. Has nothing to do with this library

vil1 commented 6 years ago

Hey @mrwillis, happy to hear you found a solution (and I'm also happy to that this lib is of help to you). Happy hacking!