Skip to content

Exceptions

boostylib.http.exceptions.BoostyError

Bases: Exception

Base exception for all boostylib errors.

Source code in src/boostylib/http/exceptions.py
class BoostyError(Exception):
    """Base exception for all boostylib errors."""

    def __init__(self, message: str, *, status_code: int | None = None) -> None:
        super().__init__(message)
        self.status_code = status_code

boostylib.http.exceptions.BoostyAuthError

Bases: BoostyError

401 Unauthorized — invalid or expired token.

Source code in src/boostylib/http/exceptions.py
class BoostyAuthError(BoostyError):
    """401 Unauthorized — invalid or expired token."""

    def __init__(self, message: str = "Authentication failed") -> None:
        super().__init__(message, status_code=401)

boostylib.http.exceptions.BoostyForbiddenError

Bases: BoostyError

403 Forbidden — insufficient permissions.

Source code in src/boostylib/http/exceptions.py
class BoostyForbiddenError(BoostyError):
    """403 Forbidden — insufficient permissions."""

    def __init__(self, message: str = "Access forbidden") -> None:
        super().__init__(message, status_code=403)

boostylib.http.exceptions.BoostyNotFoundError

Bases: BoostyError

404 Not Found.

Source code in src/boostylib/http/exceptions.py
class BoostyNotFoundError(BoostyError):
    """404 Not Found."""

    def __init__(self, message: str = "Resource not found") -> None:
        super().__init__(message, status_code=404)

boostylib.http.exceptions.BoostyRateLimitError

Bases: BoostyError

429 Too Many Requests.

Source code in src/boostylib/http/exceptions.py
class BoostyRateLimitError(BoostyError):
    """429 Too Many Requests."""

    def __init__(
        self,
        message: str = "Rate limit exceeded",
        *,
        retry_after: float | None = None,
    ) -> None:
        super().__init__(message, status_code=429)
        self.retry_after = retry_after

boostylib.http.exceptions.BoostyServerError

Bases: BoostyError

5xx Server Error.

Source code in src/boostylib/http/exceptions.py
class BoostyServerError(BoostyError):
    """5xx Server Error."""

    def __init__(self, message: str = "Server error", *, status_code: int = 500) -> None:
        super().__init__(message, status_code=status_code)

boostylib.http.exceptions.BoostyNetworkError

Bases: BoostyError

Network-level errors: timeouts, DNS failures, connection errors.

Source code in src/boostylib/http/exceptions.py
class BoostyNetworkError(BoostyError):
    """Network-level errors: timeouts, DNS failures, connection errors."""

    def __init__(self, message: str = "Network error", *, cause: Exception | None = None) -> None:
        super().__init__(message, status_code=None)
        self.__cause__ = cause