BerkeleyTrue / react-redux-epic

37 stars 13 forks source link

Throw errors to lifecycle so they can be handled #2

Closed danielronnkvist closed 7 years ago

danielronnkvist commented 7 years ago

I'm not really sure what's the best way to go. But I wanted to be able to catch errors that occurs in my epics. And then handle them all using the same function.

So now it's possible from the renderToString method to hook a catch method which will get called when epics throws errors.

BerkeleyTrue commented 7 years ago

Thanks for the PR @danielronnkvist

This is definitely a bug. lifecycle isn't really meant to be used by the end-user and is only there so that we can determine when all the epics have completed (important for SSR). I suggest instead passing the error to results.error. This results observable is the mock for the actual observable created by the your root epic.

danielronnkvist commented 7 years ago

Ok, great that you solved it. Will close the PR now.