Skip to content

Commit

Permalink
Backend/Infra: ignore warn report prob (cold mode)
Browse files Browse the repository at this point in the history
In cold storage mode, trying to send Sentry warnings would
cause an exception, but we want to ignore those, otherwise
we would crash and the wallet would never be able to run
offline.
  • Loading branch information
knocte committed Oct 31, 2023
1 parent 8ce8087 commit a670b4e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/GWallet.Backend/Infrastructure.fs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,20 @@ module Infrastructure =
raise ex
false
#else
let ev = SentryEvent(ex, Level = errorLevel)
ReportInner ev
try
let ev = SentryEvent(ex, Level = errorLevel)
ReportInner ev
with
| ex ->
if errorLevel = ErrorLevel.Error then
reraise()

//unreachable
false

else
// e.g. if in cold-storage mode, trying to report a warning would cause a crash, but let's ignore it:
false
#endif

let ReportWarning (ex: Exception): bool =
Expand Down

0 comments on commit a670b4e

Please sign in to comment.