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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
Exceptions
==========
.. automodule:: websockets.exceptions
.. autoexception:: WebSocketException
Connection closed
-----------------
:meth:`~websockets.asyncio.connection.Connection.recv`,
:meth:`~websockets.asyncio.connection.Connection.send`, and similar methods
raise the exceptions below when the connection is closed. This is the expected
way to detect disconnections.
.. autoexception:: ConnectionClosed
.. autoexception:: ConnectionClosedOK
.. autoexception:: ConnectionClosedError
Connection failed
-----------------
These exceptions are raised by :func:`~websockets.asyncio.client.connect` when
the opening handshake fails and the connection cannot be established. They are
also reported by :func:`~websockets.asyncio.server.serve` in logs.
.. autoexception:: InvalidURI
.. autoexception:: InvalidProxy
.. autoexception:: InvalidHandshake
.. autoexception:: SecurityError
.. autoexception:: ProxyError
.. autoexception:: InvalidProxyMessage
.. autoexception:: InvalidProxyStatus
.. autoexception:: InvalidMessage
.. autoexception:: InvalidStatus
.. autoexception:: InvalidHeader
.. autoexception:: InvalidHeaderFormat
.. autoexception:: InvalidHeaderValue
.. autoexception:: InvalidOrigin
.. autoexception:: InvalidUpgrade
.. autoexception:: NegotiationError
.. autoexception:: DuplicateParameter
.. autoexception:: InvalidParameterName
.. autoexception:: InvalidParameterValue
Sans-I/O exceptions
-------------------
These exceptions are only raised by the Sans-I/O implementation. They are
translated to :exc:`ConnectionClosedError` in the other implementations.
.. autoexception:: ProtocolError
.. autoexception:: PayloadTooBig
.. autoexception:: InvalidState
Miscellaneous exceptions
------------------------
.. autoexception:: ConcurrencyError
Legacy exceptions
-----------------
These exceptions are only used by the legacy :mod:`asyncio` implementation.
.. autoexception:: InvalidStatusCode
.. autoexception:: AbortHandshake
.. autoexception:: RedirectHandshake
|