mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 05:17:25 +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:
parent
f2d8ea2997
commit
6dbf466009
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user