From bbb76b5eef33e7dc3fdec63967fc44383c08b6e7 Mon Sep 17 00:00:00 2001 From: Niklas Berglund Date: Wed, 21 Aug 2024 09:39:01 +0200 Subject: [PATCH] Handle null response object --- .../kotlin/net/mullvad/mullvadvpn/test/e2e/LoginTest.kt | 1 - .../mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/LoginTest.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/LoginTest.kt index bfcc1181dd35..505c946cc5f6 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/LoginTest.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/LoginTest.kt @@ -5,7 +5,6 @@ import net.mullvad.mullvadvpn.test.common.constant.LOGIN_FAILURE_TIMEOUT import net.mullvad.mullvadvpn.test.common.extension.clickAgreeOnPrivacyDisclaimer import net.mullvad.mullvadvpn.test.common.extension.clickAllowOnNotificationPermissionPromptIfApiLevel33AndAbove import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout -import net.mullvad.mullvadvpn.test.e2e.annotations.HighlyRateLimited import net.mullvad.mullvadvpn.test.e2e.misc.AccountTestRule import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt index 734f26653749..eaff4290eddd 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt @@ -194,7 +194,14 @@ class SimpleMullvadHttpClient(context: Context) { "Unable to verify account due to invalid account or connectivity issues." private val onErrorResponse = { error: VolleyError -> - Logger.e("Response returned error status code: ${error.networkResponse.statusCode}") + if (error.networkResponse != null) { + Logger.e( + "Response returned error message: ${error.message} " + + "status code: ${error.networkResponse.statusCode}" + ) + } else { + Logger.e("Response returned error: ${error.message}") + } } } }