mirror of
https://github.com/ppy/osu.git
synced 2025-02-11 05:42:58 +08:00
Improve exception logging of unobserved exceptions via FireAndForget
Coming from https://github.com/ppy/osu/issues/27076, where the log output makes finding where the exception arrived for nigh impossible.
This commit is contained in:
parent
7460d077f7
commit
0d7e82ab8d
@ -23,9 +23,12 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
|
|
||||||
Debug.Assert(exception != null);
|
Debug.Assert(exception != null);
|
||||||
|
|
||||||
string message = exception.GetHubExceptionMessage() ?? exception.Message;
|
if (exception.GetHubExceptionMessage() is string message)
|
||||||
|
// Hub exceptions generally contain something we can show the user directly.
|
||||||
Logger.Log(message, level: LogLevel.Important);
|
Logger.Log(message, level: LogLevel.Important);
|
||||||
|
else
|
||||||
|
Logger.Error(exception, $"Unobserved exception occurred via {nameof(FireAndForget)} call: {exception.Message}");
|
||||||
|
|
||||||
onError?.Invoke(exception);
|
onError?.Invoke(exception);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user