Skip to content

Exceptions

Custom exception hierarchy for COMcheck API errors.

exceptions

Custom exceptions for COMcheck API client.

COMCheckAPIError

Bases: Exception

Base exception for COMcheck API errors.

COMCheckHTTPError

COMCheckHTTPError(status_code, message, response_data='')

Bases: COMCheckAPIError

HTTP request failed.

Initialize with the HTTP status code, message, and optional response body.

Parameters:

Name Type Description Default
status_code int

The HTTP status code returned by the API.

required
message str

Human-readable error description.

required
response_data str

Raw response body text (empty string if unavailable).

''
Source code in comcheck_api/exceptions.py
def __init__(self, status_code: int, message: str, response_data: str = ""):
    """Initialize with the HTTP status code, message, and optional response body.

    Args:
        status_code: The HTTP status code returned by the API.
        message: Human-readable error description.
        response_data: Raw response body text (empty string if unavailable).
    """
    self.status_code = status_code
    self.response_data = response_data
    super().__init__(f"HTTP {status_code}: {message}")

COMCheckValidationError

Bases: COMCheckAPIError

Raised when request or response data fails Pydantic or schema validation.

COMCheckConnectionError

Bases: COMCheckAPIError

Raised when the HTTP client cannot reach the COMcheck API server.

COMCheckSimulationError

Bases: COMCheckAPIError

Raised when a simulation request fails or returns unexpected data.

COMCheckProjectNotFoundError

COMCheckProjectNotFoundError(project_id)

Bases: COMCheckAPIError

Project not found.

Initialize with the ID of the project that was not found.

Parameters:

Name Type Description Default
project_id str

The project ID that could not be located.

required
Source code in comcheck_api/exceptions.py
def __init__(self, project_id: str):
    """Initialize with the ID of the project that was not found.

    Args:
        project_id: The project ID that could not be located.
    """
    self.project_id = project_id
    super().__init__(f"Project with ID '{project_id}' not found")