Skip to content

Commit 2c690b1

Browse files
authored
Merge pull request #32299 from smoogipoo/fix-invalid-password-message
Fix error message on invalid room password
2 parents 4344e08 + 7fdadbd commit 2c690b1

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

osu.Game/Online/Multiplayer/InvalidPasswordException.cs

+4
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ namespace osu.Game.Online.Multiplayer
99
[Serializable]
1010
public class InvalidPasswordException : HubException
1111
{
12+
public InvalidPasswordException()
13+
: base("Invalid password")
14+
{
15+
}
1216
}
1317
}

osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerLoungeSubScreen.cs

+11-6
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,17 @@ protected override void JoinInternal(Room room, string? password, Action<Room> o
8484
onSuccess(room);
8585
else
8686
{
87-
const string message = "Failed to join multiplayer room.";
88-
89-
if (result.Exception != null)
90-
Logger.Error(result.Exception, message);
91-
92-
onFailure.Invoke(result.Exception?.AsSingular().Message ?? message);
87+
Exception? exception = result.Exception?.AsSingular();
88+
89+
if (exception?.GetHubExceptionMessage() is string message)
90+
onFailure(message);
91+
else
92+
{
93+
const string generic_failure_message = "Failed to join multiplayer room.";
94+
if (result.Exception != null)
95+
Logger.Error(result.Exception, generic_failure_message);
96+
onFailure(generic_failure_message);
97+
}
9398
}
9499
});
95100
}

0 commit comments

Comments
 (0)