Source code for grad300_client.exceptions

from __future__ import annotations

from typing import Any


[docs] class Grad300Error(Exception): """Base exception for grad300-client."""
[docs] class Grad300APIError(Grad300Error): """Exception raised for API error responses. Attributes ---------- status_code : int HTTP status code returned by the backend. response_body : Any | None Parsed response payload, when available. """
[docs] def __init__( self, status_code: int, message: str, *, response_body: Any | None = None, ) -> None: """Initialize API error details. Parameters ---------- status_code : int HTTP status code returned by the backend. message : str Human-readable error message. response_body : Any | None, optional Parsed response payload. """ super().__init__(message) self.status_code = status_code self.response_body = response_body
[docs] class AuthenticationError(Grad300APIError): """Raised when authentication fails or token is missing/invalid."""