1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 23:43:03 +08:00

Add unhandled exception marking

This commit is contained in:
Dean Herbert 2022-05-10 15:07:02 +09:00
parent 99e6d56508
commit c6112b3ae7

View File

@ -11,6 +11,7 @@ using osu.Framework.Bindables;
using osu.Framework.Logging;
using osu.Game.Online.API.Requests.Responses;
using Sentry;
using Sentry.Protocol;
namespace osu.Game.Utils
{
@ -73,6 +74,13 @@ namespace osu.Game.Utils
lastException = exception;
// framework does some weird exception redirection which means sentry does not see unhandled exceptions using its automatic methods.
// but all unhandled exceptions still arrive via this pathway. we just need to mark them as unhandled for tagging purposes.
// easiest solution is to check the message matches what the framework logs this as.
// see https://github.com/ppy/osu-framework/blob/f932f8df053f0011d755c95ad9a2ed61b94d136b/osu.Framework/Platform/GameHost.cs#L336
bool wasHandled = entry.Message != @"An unhandled exception has occurred.";
exception.Data[Mechanism.HandledKey] = wasHandled;
SentrySdk.CaptureEvent(new SentryEvent(exception)
{
Message = entry.Message,