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.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using osu.Framework.Extensions.ExceptionExtensions;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
|
||||||
namespace osu.Game.Online.Multiplayer
|
namespace osu.Game.Online.Multiplayer
|
||||||
@ -16,12 +17,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
{
|
{
|
||||||
if (t.IsFaulted)
|
if (t.IsFaulted)
|
||||||
{
|
{
|
||||||
Exception? exception = t.Exception;
|
Debug.Assert(t.Exception != null);
|
||||||
|
Exception exception = t.Exception.AsSingular();
|
||||||
if (exception is AggregateException ae)
|
|
||||||
exception = ae.InnerException;
|
|
||||||
|
|
||||||
Debug.Assert(exception != null);
|
|
||||||
|
|
||||||
if (exception.GetHubExceptionMessage() is string message)
|
if (exception.GetHubExceptionMessage() is string message)
|
||||||
// Hub exceptions generally contain something we can show the user directly.
|
// Hub exceptions generally contain something we can show the user directly.
|
||||||
|
@ -476,12 +476,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
onSuccess(room);
|
onSuccess(room);
|
||||||
else if (t.IsFaulted)
|
else if (t.IsFaulted)
|
||||||
{
|
{
|
||||||
Exception? exception = t.Exception;
|
Debug.Assert(t.Exception != null);
|
||||||
|
Exception exception = t.Exception.AsSingular();
|
||||||
if (exception is AggregateException ae)
|
|
||||||
exception = ae.InnerException;
|
|
||||||
|
|
||||||
Debug.Assert(exception != null);
|
|
||||||
|
|
||||||
if (exception.GetHubExceptionMessage() is string message)
|
if (exception.GetHubExceptionMessage() is string message)
|
||||||
onError(message);
|
onError(message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user