Error Handling
Everything that goes wrong reaches your game through OnError, as an ErrorData and a flag saying
whether the error is terminal.
ErrorData has:
Code: the raw error code string.ErrorCode: the same code as aPairiquiumErrorCodeenum, forswitchstatements.Message: a human-readable description.Details: optional extra data. ForPLAYER_ATTRIBUTE_REQUIREDit names the missing attribute.
Example
using Pairiquium.Messages;
_matchmaking.OnError.AddListener((error, isTerminal) =>
{
switch (error.ErrorCode)
{
case PairiquiumErrorCode.GameModeNotFound:
case PairiquiumErrorCode.GameModeDisabled:
ShowMessage("That game mode isn't available right now.");
break;
case PairiquiumErrorCode.BillingAccessDenied:
case PairiquiumErrorCode.TokenQuotaExceeded:
case PairiquiumErrorCode.WaitlistAccessDenied:
// Problems with your Pairiquium account, not the player. Alert yourself.
LogToYourBackend(error.Code);
ShowMessage("Matchmaking is unavailable. Please try again later.");
break;
case PairiquiumErrorCode.ConnectionFailed:
// Couldn't reach your ticket endpoint or Pairiquium. The SDK is retrying.
break;
default:
Debug.LogWarning($"{error.Code}: {error.Message}");
break;
}
});Terminal errors
When isTerminal is true, the server ended the search and the SDK will not reconnect. The
state becomes Faulted.
| Code | Meaning |
|---|---|
BILLING_ACCESS_DENIED | The account is suspended for billing. |
TOKEN_QUOTA_EXCEEDED | Usage for this billing cycle is used up. |
WAITLIST_ACCESS_DENIED | The tenant is still on the signup waitlist. |
PLAYER_ATTRIBUTE_REQUIRED | The game mode needs an attribute such as mmr that the ticket didn't carry. Details names it. |
The first three are about your Pairiquium account, not the player, so log them somewhere you will
see. For PLAYER_ATTRIBUTE_REQUIRED, fix the ticket your backend mints (see
Ticket Endpoint), then call BeginSearchAsync again.
Recoverable errors
These leave the connection open, and the search continues.
| Code | Meaning |
|---|---|
GAME_MODE_NOT_FOUND | The game mode ID doesn't exist for your tenant. |
GAME_MODE_DISABLED | The game mode isn't accepting new searches. |
SEARCH_START_FAILED | The search couldn't be queued and was rolled back, so nothing is searching. The SDK leaves Searching; call BeginSearchAsync again to retry. |
INVALID_MESSAGE | The server couldn't parse a message. This shouldn't happen with the SDK. |
INTERNAL_ERROR | An unexpected server error. Safe to retry. |
Party errors (NOT_PARTY_LEADER, PARTY_TOO_LARGE, PARTY_NOT_FOUND and the rest, listed in
Parties) are also recoverable and never close the connection. When
one of them rejects a BeginSearchAsync, the SDK drops out of Searching because nothing was queued.
STALE_PONG is handled by the SDK itself (it re-sends the search), so you shouldn't need to react
to it.
Errors added by the SDK
CONNECTION_FAILED is raised by the SDK, never by the server. It means a ticket couldn't be fetched
or the WebSocket couldn't open, for example because your ticket endpoint is unreachable. It is not
terminal: the SDK retries with the same backoff it uses for dropped connections (see
Automatic Behaviour). The Message carries the underlying
reason.
Unknown codes
A newer server may send a code this version of the SDK doesn't know. It arrives as
PairiquiumErrorCode.Unknown, with the raw string still in Code. Unknown codes are treated as
non-terminal.
Next
Playing with friends? See Parties. Otherwise, see what the SDK does for you without any code: Automatic Behaviour.