Skip to content

DraftBuzz Errors

errors

GriddyDraftBuzzError dataclass

GriddyDraftBuzzError(message, raw_response, body=None)

Bases: SDKError

The base class for all DraftBuzz SDK HTTP error responses.

Source code in src/griddy/draftbuzz/errors/griddydraftbuzzerror.py
def __init__(
    self, message: str, raw_response: httpx.Response, body: Optional[str] = None
):
    """Initialize with a message, raw HTTP response, and optional body text."""
    super().__init__(message, raw_response, body)

ParsingError

ParsingError(
    message, *, url=None, selector=None, html_sample=None
)

Bases: GriddyError

Raised when DraftBuzz HTML parsing fails to find expected elements.

Provides context about what was being parsed and where, making it easier to diagnose issues with changed page structures.

Attributes:

Name Type Description
url

The DraftBuzz URL that was fetched.

selector

The CSS selector or element identifier that was not found.

html_sample

A truncated sample of the HTML for debugging.

Parameters:

Name Type Description Default
message str

Description of the parsing failure.

required
url Optional[str]

The DraftBuzz URL that was fetched.

None
selector Optional[str]

The CSS selector or element identifier that was not found.

None
html_sample Optional[str]

A truncated sample of the HTML for debugging.

None
Source code in src/griddy/draftbuzz/errors/parsing_error.py
def __init__(
    self,
    message: str,
    *,
    url: Optional[str] = None,
    selector: Optional[str] = None,
    html_sample: Optional[str] = None,
) -> None:
    """Initialize with a message and optional context about the failed parse.

    Args:
        message: Description of the parsing failure.
        url: The DraftBuzz URL that was fetched.
        selector: The CSS selector or element identifier that was not found.
        html_sample: A truncated sample of the HTML for debugging.
    """
    super().__init__(message)
    self.url = url
    self.selector = selector
    self.html_sample = html_sample

GriddyDraftBuzzDefaultError dataclass

GriddyDraftBuzzDefaultError(
    message, raw_response, body=None
)

Bases: GriddyDraftBuzzError

The fallback error class if no more specific error class is matched.

Source code in src/griddy/draftbuzz/errors/griddydraftbuzzdefaulterror.py
def __init__(
    self, message: str, raw_response: httpx.Response, body: Optional[str] = None
):
    """Initialize with a formatted error message, raw HTTP response, and optional body text."""
    message = format_error_message(message, raw_response, body)
    super().__init__(message, raw_response, body)

NoResponseError dataclass

NoResponseError(message='No response received')

Bases: GriddyError

Error raised when no HTTP response is received from the server.

Inherits from GriddyError so that catching GriddyError will also catch no-response errors.

Source code in src/griddy/core/errors/no_response_error.py
def __init__(self, message: str = "No response received"):
    """Initialize with an optional error message."""
    object.__setattr__(self, "message", message)
    object.__setattr__(self, "status_code", None)
    object.__setattr__(self, "response_data", {})
    Exception.__init__(self, message)

ResponseValidationError dataclass

ResponseValidationError(
    message, raw_response, cause, body=None
)

Bases: GriddyDraftBuzzError

Error raised when there is a type mismatch between the response data and the expected Pydantic model.

Source code in src/griddy/draftbuzz/errors/responsevalidationerror.py
def __init__(
    self,
    message: str,
    raw_response: httpx.Response,
    cause: Exception,
    body: Optional[str] = None,
):
    """Initialize with a message, raw HTTP response, causal exception, and optional body text."""
    message = f"{message}: {cause}"
    super().__init__(message, raw_response, body)

cause property

cause

Normally the Pydantic ValidationError