mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 06:23:20 +08:00
Simplify error handling of JoinRoom call
This commit is contained in:
parent
d27b83d678
commit
c3c3364d39
@ -83,15 +83,19 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
|
|||||||
{
|
{
|
||||||
Debug.Assert(room.RoomID.Value != null);
|
Debug.Assert(room.RoomID.Value != null);
|
||||||
|
|
||||||
var joinTask = multiplayerClient.JoinRoom(room);
|
multiplayerClient.JoinRoom(room).ContinueWith(t =>
|
||||||
joinTask.ContinueWith(_ => Schedule(() => onSuccess?.Invoke(room)), TaskContinuationOptions.OnlyOnRanToCompletion);
|
|
||||||
joinTask.ContinueWith(t =>
|
|
||||||
{
|
{
|
||||||
PartRoom();
|
if (t.IsCompletedSuccessfully)
|
||||||
if (t.Exception != null)
|
Schedule(() => onSuccess?.Invoke(room));
|
||||||
Logger.Error(t.Exception, "Failed to join multiplayer room.");
|
else
|
||||||
Schedule(() => onError?.Invoke(t.Exception?.ToString() ?? string.Empty));
|
{
|
||||||
}, TaskContinuationOptions.NotOnRanToCompletion);
|
if (t.Exception != null)
|
||||||
|
Logger.Error(t.Exception, "Failed to join multiplayer room.");
|
||||||
|
|
||||||
|
PartRoom();
|
||||||
|
Schedule(() => onError?.Invoke(t.Exception?.ToString() ?? string.Empty));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePolling()
|
private void updatePolling()
|
||||||
|
Loading…
Reference in New Issue
Block a user