taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 7587ccdd9558d97b3a4f6015d0262942647299eb
parent 643226c49eb98332762a92c72bc8049bdf28c05e
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 11 Apr 2024 22:54:12 +0200

error handling, logging

Diffstat:
MTalerWallet1/Backend/WalletCore.swift | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/TalerWallet1/Backend/WalletCore.swift b/TalerWallet1/Backend/WalletCore.swift @@ -415,7 +415,11 @@ extension WalletCore { sendRequest(request: reqData) { requestId, timeSent, result, error in let timeUsed = Date.now - timeSent let millisecs = timeUsed.milliseconds - self.logger.info("Request \"id\":\(requestId, privacy: .public) took \(millisecs, privacy: .public) ms") + if let error { + self.logger.error("Request \"id\":\(requestId, privacy: .public) failed after \(millisecs, privacy: .public) ms") + } else { + self.logger.info("Request \"id\":\(requestId, privacy: .public) took \(millisecs, privacy: .public) ms") + } var err: Error? = nil if let json = result, error == nil { do { @@ -442,7 +446,8 @@ extension WalletCore { err = error // this will be thrown in continuation.resume(throwing:), otherwise keep nil } } else { - if let error = error { + // TODO: WALLET_CORE_REQUEST_CANCELLED + if let error { self.lastError = FullError(type: "error", operation: request.operation(), id: requestId, error: error) } else { self.lastError = nil