Error handling in RxJava/RxKotlin

Aanand Shekhar Roy
AndroidPub
Published in
4 min readFeb 14, 2018

--

If you’ve worked with RxJava/RxKotlin, you might be familiar with three methods of a subscriber. onNext , onError and onComplete. In a reactive stream, elements are consumed by onNext first, and onComplete is called when the stream ends. If you encounter any error in onNext, the complete observable chain is abandoned and control is shifted to onError method. So for example, the below code will run perfectly and will provide the…

--

--

Aanand Shekhar Roy
AndroidPub

Senior Software Engineer @Joist, Author of Kotlin Programming Cookbook.