Skip to content

Exceptions

exceptions

Custom exception classes for cdpwave errors.

CDPError

Bases: Exception

Base exception for all cdpwave errors.

Source code in cdpwave/exceptions.py
class CDPError(Exception):
    """Base exception for all cdpwave errors."""

ConnectionClosedError

Bases: CDPError

Raised when the WebSocket connection is closed.

Source code in cdpwave/exceptions.py
class ConnectionClosedError(CDPError):
    """Raised when the WebSocket connection is closed."""

CommandError

Bases: CDPError

Raised when a CDP command returns an error response.

Attributes:

Name Type Description
code

The CDP error code.

message

The CDP error message.

data

Optional additional error data from the CDP response.

Source code in cdpwave/exceptions.py
class CommandError(CDPError):
    """Raised when a CDP command returns an error response.

    Attributes:
        code: The CDP error code.
        message: The CDP error message.
        data: Optional additional error data from the CDP response.
    """

    def __init__(self, code: int, message: str, data: dict[str, object] | None = None) -> None:
        self.code = code
        self.message = message
        self.data = data
        super().__init__(f"[{code}] {message}")

CommandTimeoutError

Bases: CDPError

Raised when a CDP command does not respond within the timeout.

Source code in cdpwave/exceptions.py
class CommandTimeoutError(CDPError):
    """Raised when a CDP command does not respond within the timeout."""

BrowserNotFoundError

Bases: CDPError

Raised when no Chromium-based browser is found on the system.

Source code in cdpwave/exceptions.py
class BrowserNotFoundError(CDPError):
    """Raised when no Chromium-based browser is found on the system."""

SessionClosedError

Bases: CDPError

Raised when a CDP session is closed by the browser.

Source code in cdpwave/exceptions.py
class SessionClosedError(CDPError):
    """Raised when a CDP session is closed by the browser."""

DiscoveryError

Bases: CDPError

Raised when an HTTP discovery endpoint request fails.

Source code in cdpwave/exceptions.py
class DiscoveryError(CDPError):
    """Raised when an HTTP discovery endpoint request fails."""

LaunchTimeoutError

Bases: CDPError

Raised when the browser does not start within the specified timeout.

Source code in cdpwave/exceptions.py
class LaunchTimeoutError(CDPError):
    """Raised when the browser does not start within the specified timeout."""

LaunchError

Bases: CDPError

Raised when the browser crashes or fails during startup.

Source code in cdpwave/exceptions.py
class LaunchError(CDPError):
    """Raised when the browser crashes or fails during startup."""