Spaces:
Running
Running
| """ | |
| Custom exceptions for Steam API errors. | |
| Separate module to avoid circular imports between mongodb.py and steam_service.py. | |
| """ | |
| class SteamAPIError(Exception): | |
| """Raised when Steam API returns a non-retryable error (404, 403, other 4xx).""" | |
| def __init__(self, status_code: int, app_id: str, message: str = "") -> None: | |
| self.status_code = status_code | |
| self.app_id = app_id | |
| self.message = message or f"Steam API error {status_code} for app {app_id}" | |
| super().__init__(self.message) | |
| class SteamRateLimitError(SteamAPIError): | |
| """Raised when Steam API returns 429 after all retries are exhausted.""" | |
| def __init__(self, app_id: str) -> None: | |
| super().__init__(status_code=429, app_id=app_id, message=f"Steam API rate limited for app {app_id}") | |