class AgentPayError(Exception): """Base exception class for AgentPay SDK errors.""" pass class AgentPayAPIError(AgentPayError): """Raised when the AgentPay API returns an error response.""" def __init__(self, status_code: int, error_code: str | None = None, error_message: str | None = None): self.status_code = status_code self.error_code = error_code self.error_message = error_message detail = f"API returned status {status_code}" if error_code: detail += f" (Code: {error_code})" if error_message: detail += f": {error_message}" super().__init__(detail) class AgentPayConnectionError(AgentPayError): """Raised when there is a network issue connecting to the AgentPay API.""" pass