Im using Single to get some object on success response on retrofit and I'm using SingleObserver
to get it. And when I have onSuccess, all works just fine. But to handle onError
, SingleObserver
hava Throwable, on Response, but I want to get response code, not all error message. How to do this?
@Override
public void getContainerPropertyCombination(ContainerPropertyCombinationListener containerPropertyCombinationListener) {
formingService.getContainerPropertyCombination(storageHelper.getString(AUTH_TOKEN)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<List<ContainerPropertyCombination>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(List<ContainerPropertyCombination> containerPropertyCombinations) {
containerPropertyCombinationListener.onSuccess(containerPropertyCombinations);
}
@Override
public void onError(Throwable e) {
}
});
}