We are making a change to the Lobby service to improve the user experience for a certain error edge case.
Currently, if you make a JoinByCode request and you provide an invalid Join Code (e.g. one with an invalid character, such as a ‘%’ sign), the service will return a ValidationError (16000). If you dig into the details of the thrown exception you can find a message that indicates that there was an invalid join code.
lobby code 'AB%CD' is invalid because it contains an invalid character '%' (index 2)
Unfortunately, there are scenarios where certain UI components can add invisible whitespace characters to the join code before passing it to the service so you might see an error like this:
lobby code 'ABCD' is invalid because it contains an invalid character '' (index 0)
This is a difficult error to understand, on top of the fact that you can only uncover this detail by digging into the exception object.
We have added an additional error code InvalidJoinCode (16010) and improved the error message to make this error more obvious and easier to handle in your code. For example:
lobby code 'ABCD' is invalid because it contains an invalid character '' (U+2062) at index 0
If you are using the com.unity.services.lobby SDK version <= 1.1.0-pre.1, you will start seeing error code 16010 even though the LobbyExceptionReason
enumeration does not contain a definition for this error code. Your application should continue to function, but if you have logic that depends on getting error code 16000 to deal with this specific edge case it may not work as expected. This is an UNLIKELY use case, as you would need to be manually checking the error details of the exception.
The 1.1.0 release of the SDK will include the new error code. If you want to handle this error code prior to upgrading the SDK, you can do so by explicitly creating the error code with that value.
var invalidJoinCode = (LobbyExceptionReason)16010;
switch(error)
{
case invalidJoinCode:
// ...
}