/usr/lib/python3/dist-packages/websockets/exceptions.py is in python3-websockets 3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | __all__ = [
'InvalidHandshake', 'InvalidOrigin', 'InvalidState', 'InvalidURI',
'ConnectionClosed', 'PayloadTooBig', 'WebSocketProtocolError',
]
class InvalidHandshake(Exception):
"""
Exception raised when a handshake request or response is invalid.
"""
class InvalidOrigin(InvalidHandshake):
"""
Exception raised when the origin in a handshake request is forbidden.
"""
class InvalidState(Exception):
"""
Exception raised when an operation is forbidden in the current state.
"""
class ConnectionClosed(InvalidState):
"""
Exception raised when trying to read or write on a closed connection.
Provides the connection close code and reason in its ``code`` and
``reason`` attributes respectively.
"""
def __init__(self, code, reason):
self.code = code
self.reason = reason
message = 'WebSocket connection is closed: '
message += 'code = {}, '.format(code) if code else 'no code, '
message += 'reason = {}.'.format(reason) if reason else 'no reason.'
super().__init__(message)
class InvalidURI(Exception):
"""
Exception raised when an URI isn't a valid websocket URI.
"""
class PayloadTooBig(Exception):
"""
Exception raised when a frame's payload exceeds the maximum size.
"""
class WebSocketProtocolError(Exception):
"""
Internal exception raised when the remote side breaks the protocol.
"""
|