From b34406a7b59f2c5413efb5eb906867f80e58fbfb Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Wed, 24 Jan 2024 21:08:30 +0800 Subject: [PATCH] Backend: morph exception wrapping at balance chk This InconsistentResultFromDifferentServersOfSameCurrency exception type was introduced in [1], but after implementing an improvement[2] over the exception message and type of another problem, I realised that the new exception thrown in [2] wouldn't be covered by the exception type mentioned above, so we need it to be more generic (to receive any exception as innerException), so let's do that and rename it. This commit in conjunction with [2] don't really fix issue 250 [3], but it might mitigate it, and anyway thanks to [1] if it happens again, we will receive a different exception, with different exception message as well, so let's close [3]. Closes https://github.com/nblockchain/geewallet/issues/250 [1] 8fa47e0e2bd1b325761c7bdc9f8e32a5955b0f5c [2] 5eca67170579b44b9598e57656fbd3118b9e14dd [3] https://github.com/nblockchain/geewallet/issues/250 --- src/GWallet.Backend/Account.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GWallet.Backend/Account.fs b/src/GWallet.Backend/Account.fs index 08d708690..1a923af84 100644 --- a/src/GWallet.Backend/Account.fs +++ b/src/GWallet.Backend/Account.fs @@ -8,9 +8,9 @@ open System.Threading.Tasks open GWallet.Backend.FSharpUtil.UwpHacks // this exception, if it happens, it would cause a crash because we don't handle it yet -type InconsistentResultFromDifferentServersOfSameCurrency(currency: Currency, - innerException: ResultInconsistencyException) = - inherit Exception (SPrintF2 "Inconsistent results retrieving info for currency %A: %s" +type UnhandledCurrencyServerException(currency: Currency, + innerException: Exception) = + inherit Exception (SPrintF2 "Issue when retrieving %A currency balance: %s" currency innerException.Message, innerException) @@ -55,8 +55,8 @@ module Account = balance return Fresh compoundBalance with - | :? ResultInconsistencyException as innerEx -> - return raise <| InconsistentResultFromDifferentServersOfSameCurrency(account.Currency, innerEx) + | ex -> + return raise <| UnhandledCurrencyServerException(account.Currency, ex) } let internal GetAccountFromFile accountFile (currency: Currency) kind: IAccount =