Retrofit 2: Catch connection timeout exception

后端 未结 7 1261
执念已碎
执念已碎 2020-11-27 03:26

I have the following setup:

final OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.setReadTimeout(5, TimeUnit.SECONDS);
okHttpClient.setConnectTi         


        
7条回答
  •  执念已碎
    2020-11-27 04:15

    Apparently the exception does get wrapped into a RetrofitException so you can handle it in the failure method.

提交回复
热议问题