From b2667fb9f4f81c0b7a11219b2791a09c887f1283 Mon Sep 17 00:00:00 2001 From: Mateusz Armatys Date: Fri, 19 Apr 2024 16:10:47 +0200 Subject: [PATCH] chore(network): Add a warning log if clientId is missing in `HumanVerificationNeededHandler`. --- .../domain/handlers/HumanVerificationNeededHandler.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/network/domain/src/main/kotlin/me/proton/core/network/domain/handlers/HumanVerificationNeededHandler.kt b/network/domain/src/main/kotlin/me/proton/core/network/domain/handlers/HumanVerificationNeededHandler.kt index 18d7c2d6e..ff334d95f 100644 --- a/network/domain/src/main/kotlin/me/proton/core/network/domain/handlers/HumanVerificationNeededHandler.kt +++ b/network/domain/src/main/kotlin/me/proton/core/network/domain/handlers/HumanVerificationNeededHandler.kt @@ -24,12 +24,14 @@ import me.proton.core.network.domain.ApiBackend import me.proton.core.network.domain.ApiErrorHandler import me.proton.core.network.domain.ApiManager import me.proton.core.network.domain.ApiResult +import me.proton.core.network.domain.LogTag import me.proton.core.network.domain.ResponseCodes import me.proton.core.network.domain.client.ClientId import me.proton.core.network.domain.client.ClientIdProvider import me.proton.core.network.domain.humanverification.HumanVerificationAvailableMethods import me.proton.core.network.domain.humanverification.HumanVerificationListener import me.proton.core.network.domain.session.SessionId +import me.proton.core.util.kotlin.CoreLogger import org.jetbrains.annotations.TestOnly import java.util.concurrent.TimeUnit @@ -50,7 +52,11 @@ class HumanVerificationNeededHandler( call: ApiManager.Call ): ApiResult { // Do we have a clientId ? - val clientId = clientIdProvider.getClientId(sessionId) ?: return error + val clientId = clientIdProvider.getClientId(sessionId) + if (clientId == null) { + CoreLogger.w(LogTag.DEFAULT, "HumanVerificationNeededHandler: clientId not found.") + return error + } // Recoverable with human verification ? if (error !is ApiResult.Error.Http || error.proton?.code != ResponseCodes.HUMAN_VERIFICATION_REQUIRED) {