File size: 801 Bytes
8ff1b66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
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}")