Skip to content

Commit

Permalink
ignore api and web timeout exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
flustix committed Jul 16, 2024
1 parent 61ab275 commit 3092ca0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion fluXis.Game/Utils/Sentry/SentryClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Net;
using fluXis.Game.Configuration;
using fluXis.Game.Online.API;
using fluXis.Shared.Components.Users;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
Expand Down Expand Up @@ -62,7 +64,7 @@ private void onEntry(LogEntry entry)

var ex = entry.Exception;

if (ex == null)
if (ex == null || shouldIgnore(ex))
return;

SentrySdk.CaptureEvent(new SentryEvent(ex)
Expand All @@ -86,6 +88,20 @@ private void onEntry(LogEntry entry)
});
}

private bool shouldIgnore(Exception ex)
{
switch (ex)
{
case APIException:
return true;

case WebException web:
return web.Status == WebExceptionStatus.Timeout;
}

return false;
}

protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
Expand Down

0 comments on commit 3092ca0

Please sign in to comment.