1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-27 18:21:14 +03:00

update Logging Interceptor to log connection failures

This commit is contained in:
Andy Dennie
2016-05-10 09:14:50 -04:00
committed by jwilson
parent 03d4edcc2e
commit f1dea26fd6
2 changed files with 33 additions and 1 deletions

View File

@@ -207,7 +207,13 @@ public final class HttpLoggingInterceptor implements Interceptor {
}
long startNs = System.nanoTime();
Response response = chain.proceed(request);
Response response;
try {
response = chain.proceed(request);
} catch (Exception e) {
logger.log("<-- HTTP FAILED: " + e);
throw e;
}
long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);
ResponseBody responseBody = response.body();