mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Fix multiple sentry reports arriving for similar exceptions
This commit is contained in:
@ -19,18 +19,30 @@ namespace osu.Game.Utils
|
||||
|
||||
private readonly List<Task> tasks = new List<Task>();
|
||||
|
||||
private Exception lastException;
|
||||
|
||||
public RavenLogger(OsuGame game)
|
||||
{
|
||||
raven.Release = game.Version;
|
||||
|
||||
if (!game.IsDeployedBuild) return;
|
||||
|
||||
Logger.NewEntry += entry =>
|
||||
{
|
||||
if (entry.Level < LogLevel.Verbose) return;
|
||||
|
||||
if (entry.Exception != null)
|
||||
queuePendingTask(raven.CaptureAsync(new SentryEvent(entry.Exception)));
|
||||
var exception = 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
|
||||
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
||||
};
|
||||
|
Reference in New Issue
Block a user