Skip to content

Commit

Permalink
Backend: morph exception wrapping at balance chk
Browse files Browse the repository at this point in the history
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 #250

[1] 8fa47e0
[2] 5eca671
[3] #250
  • Loading branch information
knocte committed Jan 24, 2024
1 parent 5eca671 commit b34406a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GWallet.Backend/Account.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit b34406a

Please sign in to comment.