mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 06:52:59 +08:00
Merge pull request #27077 from peppy/log-fire-and-forget-better
Improve exception logging of unobserved exceptions via `FireAndForget`
This commit is contained in:
commit
4a516cbccd
@ -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);
|
||||||
|
else
|
||||||
|
Logger.Error(exception, $"Unobserved exception occurred via {nameof(FireAndForget)} call: {exception.Message}");
|
||||||
|
|
||||||
Logger.Log(message, level: LogLevel.Important);
|
|
||||||
onError?.Invoke(exception);
|
onError?.Invoke(exception);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user