Handling Lobby and Matchmaking SDK errors
This page intends to serve as a quick reference for guidance on how the PlayFab Lobby and Matchmaking SDKs surface errors and how you should handle them. The following topics are discussed:Synchronous vs asynchronous errors
Many SDK APIs are asynchronous. You start an operation by calling an API like PFMultiplayerCreateAndJoinLobby and later that asynchronous operation completes with a “state change” like PFLobbyCreateAndJoinLobbyCompletedStateChange. This means, when using asynchronous Lobby and Matchmaking Client APIs, there are two types of errors that you must handle:- synchronous errors
- asynchronous errors
Synchronous errors
“Synchronous errors” are HRESULTs provided as the return value of an API call. These errors are generally due to calling the API with incorrect parameters, calling the API while the library is in an invalid state, or internal library failures to allocate memory. Any output parameters provided by the API should be considered invalid if the API returns a synchronous error. When calling asynchronous APIs (e.g. PFMultiplayerCreateAndJoinLobby), the synchronous error value only represents whether the requested operation was able to start. For information on understanding the result of an asynchronous operation, see the Asynchronous errors section.Asynchronous errors
“Asynchronous errors” are provided as HRESULTs in the state change associated with the asynchronous completion of each operation, the result field. These errors are typically more interesting to titles than synchronous errors. A non-exhaustive list of some of the types of errors reported asynchronously include:- service throttling errors
- invalid parameter errors that can’t be validated synchronously on the client
- errors interacting with the real-time message service
- connectivity errors
