Exceptions

Exceptions definition module.

Here are all the exception classes defined and used by the library.

exception easynetwork.exceptions.BaseProtocolParseError

Bases: Exception

Parsing error raised by a protocol object.

__init__(error: DeserializeError | PacketConversionError) None
Parameters:

error (DeserializeError | PacketConversionError) – Error instance.

error: DeserializeError | PacketConversionError

Error instance.

exception easynetwork.exceptions.BusyResourceError

Bases: RuntimeError

Error raised when a task attempts to use a resource that some other task is already using, and this would lead to bugs and nonsense.

Mostly used in asynchronous functions.

exception easynetwork.exceptions.ClientClosedError

Bases: ConnectionError

Error raised when trying to do an operation on a closed client.

exception easynetwork.exceptions.DatagramProtocolParseError

Bases: BaseProtocolParseError

Parsing error raised by easynetwork.protocol.DatagramProtocol.

exception easynetwork.exceptions.DeserializeError

Bases: Exception

Error raised by a serializer if the data format is invalid.

__init__(message: str, error_info: Any = None) None
Parameters:
  • message (str) – Error message.

  • error_info (Any) – Additional error data.

error_info: Any

Additional error data.

exception easynetwork.exceptions.IncrementalDeserializeError

Bases: DeserializeError

Error raised by an incremental serializer if the data format is invalid.

__init__(message: str, remaining_data: bytes | bytearray | memoryview | collections.abc.Buffer, error_info: Any = None) None
Parameters:
remaining_data: ReadableBuffer

Unused trailing data.

exception easynetwork.exceptions.LimitOverrunError

Bases: IncrementalDeserializeError

Reached the buffer size limit while looking for a separator.

__init__(message: str, buffer: bytes | bytearray | memoryview | collections.abc.Buffer, consumed: int, separator: bytes = b'') None
Parameters:
consumed: int

Total number of to be consumed bytes.

exception easynetwork.exceptions.PacketConversionError

Bases: Exception

The deserialized packet is invalid.

__init__(message: str, error_info: Any = None) None
Parameters:
  • message (str) – Error message.

  • error_info (Any) – Additional error data.

error_info: Any

Additional error data.

exception easynetwork.exceptions.ServerAlreadyRunning

Bases: RuntimeError

The server is already running.

exception easynetwork.exceptions.ServerClosedError

Bases: RuntimeError

Error raised when trying to do an operation on a closed server.

exception easynetwork.exceptions.StreamProtocolParseError

Bases: BaseProtocolParseError

Parsing error raised by easynetwork.protocol.StreamProtocol.

__init__(remaining_data: bytes | bytearray | memoryview | collections.abc.Buffer, error: IncrementalDeserializeError | PacketConversionError) None
Parameters:
error: IncrementalDeserializeError | PacketConversionError

Error instance.

remaining_data: ReadableBuffer

Unused trailing data.

exception easynetwork.exceptions.TypedAttributeLookupError

Bases: LookupError

Raised by extra() when the given typed attribute is not found and no default value has been given.

exception easynetwork.exceptions.UnsupportedOperation

Bases: NotImplementedError

The requested action is currently unavailable.