Retrofit 2 + RxAndroid: Handle Errors (4xx and some 200)
问题 I saw a lot of articles and questions about error handling using retrofit combined with RxAndroid, but i am not able to set my configuration right. What do I want to accomplish: when receiving a 4xx code: handle it on onError() when receiving a 2xx code: -> try to parse to expected response and deliver it onNext() -> If not possible try to convert the JSON answer to MyAPIError class (simple POJO with errorNum and message) and deliver it on onError. So either 2xx or 4xx http codes might end up