What to use instead of RetrofitError.Kind.NETWORK for the new Retrofit 2 API?

In Retrofit 1.9.x there was RetrofitError.Kind.NETWORK , which allows you to easily determine if a failure has occurred due to a network error or not. In the new API 2.0, we no longer have RetrofitError is there a simple equivalent that we can use to check if Response failed due to the network?

+6
source share
2 answers

If you look at the version of RetroFit version 1.9.0, it seems that the only time a RetrofitError is created from Kind.NETWORK is there an IOException when trying to raise a request. We should be able to simply perform the same check when using the new API 2.0.

+1
source

You no longer need RetrofitError.Kind.NETWORK.

onFailure will be called when a network error occurs or an IOException will be thrown

+1
source

All Articles