Exceptions

Lomond takes great care not to leak any socket or system related exceptions. During normal usage of WebSocket objects you can expect only the following exception hierarchy to be thrown.

exception lomond.errors.CriticalProtocolError(msg, *args, **kwargs)

Critical protocol error. An egregious error in the protocol resulting in an immediate disconnect.

exception lomond.errors.FrameBuildError(msg, *args, **kwargs)

Raised when trying to build an invalid websocket frame.

exception lomond.errors.HandshakeError(msg, *args, **kwargs)

Raised when the server doesn’t respond correctly to the websocket handshake.

exception lomond.errors.PayloadTooLarge(msg, *args, **kwargs)

The payload length field is too large.

Websocket messages have a maximum payload of 2**63 bytes. In practice it may be impossible to generate such a packet for real, but its feasible a corrupt packet header could make it appear that such a packet was being sent.

exception lomond.errors.ProtocolError(msg, *args, **kwargs)

Raised in response to a protocol violation.

exception lomond.errors.TransportFail(msg, *args, **kwargs)

The transport (socket) failed when sending.

Likely indicating connectivity issues.

exception lomond.errors.WebSocketClosed(msg, *args, **kwargs)

Raised when attempting to send over a closed websocket.

exception lomond.errors.WebSocketClosing(msg, *args, **kwargs)

Raised when attempting to send over a closing websocket.

exception lomond.errors.WebSocketError(msg, *args, **kwargs)

Base exception.

exception lomond.errors.WebSocketUnavailable(msg, *args, **kwargs)

The websocket can not be used.