Exception classes
Valaw provides several exception classes for different error scenarios. All exceptions are available undervalaw.Exceptions.
RiotAPIResponseError
Raised when the Riot API returns an error response. This exception includes the HTTP status code and error message from the API.400- Bad request (invalid parameters)401- Unauthorized (invalid or expired API key)403- Forbidden (API key doesn’t have access to this resource)404- Not found (resource doesn’t exist)429- Rate limit exceeded500- Internal server error503- Service unavailable
InvalidCluster
Raised when an invalid cluster is provided. Valid clusters are:americas, asia, esports, europe.
InvalidRegion
Raised when an invalid region is provided. Valid regions are:ap, br, esports, eu, kr, latam, na.
InvalidLocale
Raised when an invalid locale is provided for content requests.InvalidQueue
Raised when an invalid queue type is provided for match queries.InvalidPlatformType
Raised when an invalid platform type is provided for console requests. Valid platform types are:playstation, xbox.
InvalidRiotAPIKey
Raised when no API key is provided or the key is empty.FailedToParseJSON
Raised when the API response cannot be parsed as JSON.Basic error handling
Use try-except blocks to handle exceptions gracefully:Handling rate limits
When you exceed the API rate limits, the Riot API returns a429 status code. Implement retry logic with exponential backoff:
Handling authentication errors
Check for authentication issues before making API calls:Handling not found errors
When a resource doesn’t exist, the API returns a404 status code:

