mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 11:03:22 +08:00
Reduce method complexity
This commit is contained in:
parent
6f91a21f00
commit
20b6114863
@ -36,6 +36,24 @@ namespace osu.Game.Utils
|
||||
var exception = entry.Exception;
|
||||
|
||||
if (exception != null)
|
||||
{
|
||||
if (!shouldSubmitException(exception))
|
||||
return;
|
||||
|
||||
// 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 });
|
||||
};
|
||||
}
|
||||
|
||||
private bool shouldSubmitException(Exception exception)
|
||||
{
|
||||
switch (exception)
|
||||
{
|
||||
@ -45,7 +63,7 @@ namespace osu.Game.Utils
|
||||
const int hr_error_disk_full = unchecked((int)0x80070070);
|
||||
|
||||
if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
|
||||
return;
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
||||
@ -54,25 +72,13 @@ namespace osu.Game.Utils
|
||||
{
|
||||
// more statuses may need to be blocked as we come across them.
|
||||
case WebExceptionStatus.Timeout:
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// 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 });
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
private void queuePendingTask(Task<string> task)
|
||||
|
Loading…
Reference in New Issue
Block a user