mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +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);
|
||||
|
||||
var joinTask = multiplayerClient.JoinRoom(room);
|
||||
joinTask.ContinueWith(_ => Schedule(() => onSuccess?.Invoke(room)), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
joinTask.ContinueWith(t =>
|
||||
multiplayerClient.JoinRoom(room).ContinueWith(t =>
|
||||
{
|
||||
if (t.IsCompletedSuccessfully)
|
||||
Schedule(() => onSuccess?.Invoke(room));
|
||||
else
|
||||
{
|
||||
PartRoom();
|
||||
if (t.Exception != null)
|
||||
Logger.Error(t.Exception, "Failed to join multiplayer room.");
|
||||
|
||||
PartRoom();
|
||||
Schedule(() => onError?.Invoke(t.Exception?.ToString() ?? string.Empty));
|
||||
}, TaskContinuationOptions.NotOnRanToCompletion);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePolling()
|
||||
|
Loading…
Reference in New Issue
Block a user