I have below code for error handling. My issue is that when server sends a 400 error code the onErrorResumeNext is not being called. Is this expected? I thought onErrorResumeNext would be called when server sends a non 200 code(200-300).
public Single adapt(Call c) {
return ((Single) adapt(c)
.onErrorResumeNext(new Function() {
//BELOW NOT BEING EXECUTED ON 400 error from server.
@Override
public Object apply(Object throwable) throws Exception {
return Single.error(DoSomethingWithException((Throwable) throwable));
}
}).subscribeOn(Schedulers.newThread())
.observerOn(AndroidSchedulers.mainThread())
.flatMap( response -> {
}
);}