mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Fix multiple sentry reports arriving for similar exceptions
This commit is contained in:
parent
3818cd6030
commit
83dc01d07c
@ -62,9 +62,11 @@ namespace osu.Desktop
|
|||||||
{
|
{
|
||||||
bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0;
|
bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0;
|
||||||
|
|
||||||
Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed" : "denied")} with {allowableExceptions} more allowable exceptions.");
|
Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed with {allowableExceptions} more allowable exceptions" : "denied")} .");
|
||||||
|
|
||||||
|
// restore the stock of allowable exceptions after a short delay.
|
||||||
Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions));
|
Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions));
|
||||||
|
|
||||||
return continueExecution;
|
return continueExecution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,18 +19,30 @@ namespace osu.Game.Utils
|
|||||||
|
|
||||||
private readonly List<Task> tasks = new List<Task>();
|
private readonly List<Task> tasks = new List<Task>();
|
||||||
|
|
||||||
|
private Exception lastException;
|
||||||
|
|
||||||
public RavenLogger(OsuGame game)
|
public RavenLogger(OsuGame game)
|
||||||
{
|
{
|
||||||
raven.Release = game.Version;
|
raven.Release = game.Version;
|
||||||
|
|
||||||
if (!game.IsDeployedBuild) return;
|
|
||||||
|
|
||||||
Logger.NewEntry += entry =>
|
Logger.NewEntry += entry =>
|
||||||
{
|
{
|
||||||
if (entry.Level < LogLevel.Verbose) return;
|
if (entry.Level < LogLevel.Verbose) return;
|
||||||
|
|
||||||
if (entry.Exception != null)
|
var exception = entry.Exception;
|
||||||
queuePendingTask(raven.CaptureAsync(new SentryEvent(entry.Exception)));
|
|
||||||
|
if (exception != null)
|
||||||
|
{
|
||||||
|
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
||||||
|
if (lastException != null &&
|
||||||
|
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastException = exception;
|
||||||
|
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception)));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user