Source code for sgu_client.exceptions
"""Custom exceptions for SGU Client."""
[docs]
class SGUClientError(Exception):
"""Base exception for all SGU client errors."""
pass
[docs]
class SGUAPIError(SGUClientError):
"""Raised when the SGU API returns an error response."""
[docs]
def __init__(
self,
message: str,
status_code: int | None = None,
response_data: dict | None = None,
):
super().__init__(message)
self.status_code = status_code
self.response_data = response_data or {}
[docs]
class SGUConnectionError(SGUClientError):
"""Raised when connection to SGU API fails."""
pass
[docs]
class SGUTimeoutError(SGUClientError):
"""Raised when a request to SGU API times out."""
pass
[docs]
class SGUValidationError(SGUClientError):
"""Raised when data validation fails."""
pass