From 3a81521eabf75565a516f46b0ec0d9e2194c0213 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Apr 2021 10:55:43 +0200 Subject: [PATCH] Restore previous log when a request fails --- .../org/matrix/android/sdk/internal/network/Request.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt index d9f102c7e0..e39bce6c67 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt @@ -55,9 +55,13 @@ internal suspend inline fun executeRequest(globalErrorReceiver: GlobalErr else -> throwable } - // Log some details about the request which has failed. This is less useful than before... - // Timber.e("Exception when executing request ${apiCall.request().method} ${apiCall.request().url.toString().substringBefore("?")}") - Timber.e("Exception when executing request") + // Log some details about the request which has failed. + val request = (throwable as? HttpException)?.response()?.raw()?.request + if (request == null) { + Timber.e("Exception when executing request") + } else { + Timber.e("Exception when executing request ${request.method} ${request.url.toString().substringBefore("?")}") + } // Check if this is a certificateException CertUtil.getCertificateException(exception)