artem-zinnatullin / RxUi

Implementation of pure functional concept of talking to Android View layer in a Reactive way
https://artemzin.com/blog/rxui-talking-to-android-view-layer-in-a-reactive-way/
MIT License
261 stars 22 forks source link

Best practice for handling runtime exception #22

Closed lenguyenthanh closed 8 years ago

lenguyenthanh commented 8 years ago

Hey, my only concern for this beautiful idea is handling runtime exception. For example, in the real world, AuthService has a very high chance to got a runtime exception and now it is not handler. What is your best practice for this?

Thanks

artem-zinnatullin commented 8 years ago

Basically my advice is to turn expected exceptions into values in the stream and only allow unexpected exceptions to crash the app.

You can find it in the sample app btw: AuthService emits either value or error as value.