1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 05:22:54 +08:00

Improve user-facing error messages in room settings

This commit is contained in:
Bartłomiej Dach 2020-12-23 17:08:28 +01:00
parent 3b0bf11366
commit e4959489b7
2 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.ExceptionExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -299,7 +300,7 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer.Match
if (t.IsCompletedSuccessfully) if (t.IsCompletedSuccessfully)
onSuccess(currentRoom.Value); onSuccess(currentRoom.Value);
else else
onError(t.Exception?.Message ?? "Error changing settings."); onError(t.Exception?.AsSingular().Message ?? "Error changing settings.");
})); }));
} }
else else

View File

@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.ExceptionExtensions;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
@ -91,11 +92,13 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
Schedule(() => onSuccess?.Invoke(room)); Schedule(() => onSuccess?.Invoke(room));
else else
{ {
const string message = "Failed to join multiplayer room.";
if (t.Exception != null) if (t.Exception != null)
Logger.Error(t.Exception, "Failed to join multiplayer room."); Logger.Error(t.Exception, message);
PartRoom(); PartRoom();
Schedule(() => onError?.Invoke(t.Exception?.ToString() ?? string.Empty)); Schedule(() => onError?.Invoke(t.Exception?.AsSingular().Message ?? message));
} }
}); });
} }