Exceptions
The Friends service throws a FriendsServiceException when there is a problem with one of the operations in the SDK. You should handle these exceptions in the code calling those methods. The methods that can throw these exceptions are marked in the Api use examples section of this document.
Note: The Friends SDK also has method-specific exceptions. You can find these exceptions in the documentation for corresponding method.
The FriendsServiceException has a Reason field in addition to the fields normally provided by C# Exception. The Reason field is an enum value that describes the categories of the issue that triggered the exception. It provides a code-friendly way to detect and handle the various types of errors the Friends service might throw.
Inspect the Message field on a FriendsServiceException for a human-readable description of the error that was thrown.
Inspect the Reason field on a FriendsServiceException to retrieve the error code.
Error codes
Note: The Friends SDK error codes are within the range 24000-24999.
| Code | Meaning |
|---|---|
| 24400 | The Friends service cannot process the request because it is invalid. |
| 24401 | The request requires authentication. |
| 24403 | The server understood the request and refuses to fulfill it. |
| 24404 | The server cannot find the specified resource. |
| 24405 | Invalid method for the specified resource. |
| 24408 | The request took too long. |
| 24409 | There’s a conflict with the server's current state. |
| 24410 | The requested resource is no longer available. |
| 24413 | The request entity is too large. |
| 24414 | The request URI is too long. |
| 24415 | The request format is invalid. |
| 24416 | The requested ranges cannot be served. |
| 24421 | Unreachable endpoint. |
| 24422 | The request cannot be processed. |
| 24429 | Rate limit exceeded. See https://docs.unity.com/Friends/Content/rate-limits.htm for more details. |
| 24451 | The requested resource is not available. |
| 24500 | The server encountered an unexpected condition that prevented it from fulfilling the request. |
| 24501 | The server cannot fulfill the request. |
| 24502 | Invalid response from the upstream server. |
| 24503 | The server is temporarily unable to handle the request. |
| 24504 | The upstream server did not respond in time. |
| 24700 | Invalid player identifier. |
| 24701 | Invalid project identifier. |
| 24702 | Invalid environment identifier. |
| 24705 | The Limit parameter must be a positive integer. |
| 24707 | The Offset parameter must be a positive integer. |
| 24708 | The player cannot target themselves for this operation. |
| 24709 | A friend request from this player is already pending in the receiver's inbox. |
| 24710 | A friend request from this player does not exist. |
| 24712 | The friendship already exists. |
| 24713 | A friendship does not exist between the current player and the target player. |
| 24714 | The player is already blocked. |
| 24720 | The event source must be 1-255 characters long. |
| 24722 | The server could not decode the presence schema. |
| 24723 | The presence availability must be an accepted value. |
| 24726 | The friends service must be enabled on the Unity Dashboard to use the friends SDK. |
| 24998 | NetworkError is returned when the UnityWebRequest failed with this flag set. See the exception stack trace when this reason is provided for context. |
| 24999 | Unknown is returned when a unrecognized error code is returned by the service. Check the inner exception to get more information. |