Rename UnpackError to UnpackerError

This commit is contained in:
Felix Weiler-Detjen
2024-12-11 12:15:16 +01:00
parent 98099f5b00
commit af767078bf
8 changed files with 12 additions and 12 deletions

View File

@@ -27,7 +27,7 @@ See <project:serialization.md> for a tutorial on how to implement custom packer
### Errors
```{eval-rst}
.. autoclass:: heisskleber.core::UnpackError
.. autoclass:: heisskleber.core::UnpackerError
.. autoclass:: heisskleber.core::PackerError
```

View File

@@ -4,7 +4,7 @@ from .config import BaseConf, ConfigType
from .packer import JSONPacker, Packer, PackerError
from .receiver import Receiver
from .sender import Sender
from .unpacker import JSONUnpacker, Unpacker, UnpackError
from .unpacker import JSONUnpacker, Unpacker, UnpackerError
json_packer = JSONPacker()
json_unpacker = JSONUnpacker()
@@ -19,5 +19,5 @@ __all__ = [
"BaseConf",
"ConfigType",
"PackerError",
"UnpackError",
"UnpackerError",
]

View File

@@ -7,7 +7,7 @@ from typing import Any, Protocol, TypeVar
T_co = TypeVar("T_co", covariant=True)
class UnpackError(Exception):
class UnpackerError(Exception):
"""Raised when unpacking operations fail.
This exception wraps underlying errors that may occur during unpacking,
@@ -49,7 +49,7 @@ class Unpacker(Protocol[T_co]):
- dict[str, Any]: The meta data associated with the unpack operation, such as topic, timestamp or errors
Raises:
UnpackError: The payload could not be unpacked.
UnpackerError: The payload could not be unpacked.
"""
@@ -66,7 +66,7 @@ class JSONUnpacker(Unpacker[dict[str, Any]]):
- An empty dictionary for metadata (not used in JSON unpacking)
Raises:
UnpackError: If the payload cannot be decoded as valid JSON.
UnpackerError: If the payload cannot be decoded as valid JSON.
Example:
>>> unpacker = JSONUnpacker()
@@ -81,4 +81,4 @@ class JSONUnpacker(Unpacker[dict[str, Any]]):
try:
return json.loads(payload), {}
except json.JSONDecodeError as e:
raise UnpackError(payload) from e
raise UnpackerError(payload) from e

View File

@@ -62,7 +62,7 @@ class MqttReceiver(Receiver[T]):
Raises:
TypeError: If the message payload is not of type bytes.
UnpackError: If the message could not be unpacked with the unpacker protocol.
UnpackerError: If the message could not be unpacked with the unpacker protocol.
"""
if not self._listener_task:

View File

@@ -44,7 +44,7 @@ class SerialReceiver(Receiver[T]):
tuple[T, dict[str, Any]]: A tuple containing the unpacked data and any extra information.
Raises:
UnpackError: If the data could not be unpacked with the provided unpacker.
UnpackerError: If the data could not be unpacked with the provided unpacker.
"""
if not self._is_connected:

View File

@@ -36,7 +36,7 @@ class TcpReceiver(Receiver[T]):
Raises:
TypeError: If the message payload is not of type bytes.
UnpackError: If the message could not be unpacked with the unpacker protocol.
UnpackerError: If the message could not be unpacked with the unpacker protocol.
"""
data = b""

View File

@@ -69,7 +69,7 @@ class UdpReceiver(Receiver[T]):
- A dictionary containing extra information.
Raises:
UnpackError: If the received message could not be unpacked.
UnpackerError: If the received message could not be unpacked.
"""
if not self._is_connected:

View File

@@ -38,7 +38,7 @@ class ZmqReceiver(Receiver[T]):
tuple(topic: str, message: dict): the message received
Raises:
UnpackError: If payload could not be unpacked with provided unpacker.
UnpackerError: If payload could not be unpacked with provided unpacker.
"""
if not self.is_connected: