1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 02:17:19 +08:00

Fix incorrect exception handling

In particular, when the exception is:
`AggregateException { AggregateException { HubException } }`,
then the existing code will only unwrap the first aggregate exception.

The overlay's code was copied from the extension so both have been
adjusted here.
This commit is contained in:
Dan Balasescu 2025-01-23 18:30:11 +09:00
parent f2d8ea2997
commit 6dbf466009
No known key found for this signature in database
2 changed files with 5 additions and 12 deletions

View File

@ -5,6 +5,7 @@ using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using osu.Framework.Extensions.ExceptionExtensions;
using osu.Framework.Logging;
namespace osu.Game.Online.Multiplayer
@ -16,12 +17,8 @@ namespace osu.Game.Online.Multiplayer
{
if (t.IsFaulted)
{
Exception? exception = t.Exception;
if (exception is AggregateException ae)
exception = ae.InnerException;
Debug.Assert(exception != null);
Debug.Assert(t.Exception != null);
Exception exception = t.Exception.AsSingular();
if (exception.GetHubExceptionMessage() is string message)
// Hub exceptions generally contain something we can show the user directly.

View File

@ -476,12 +476,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
onSuccess(room);
else if (t.IsFaulted)
{
Exception? exception = t.Exception;
if (exception is AggregateException ae)
exception = ae.InnerException;
Debug.Assert(exception != null);
Debug.Assert(t.Exception != null);
Exception exception = t.Exception.AsSingular();
if (exception.GetHubExceptionMessage() is string message)
onError(message);