add VBANCMDPacketError to exception hierarchy

raise them when we fail to validate incoming packets.

add VbanRTRequestHeader post_init to validate the provided bps value.

VbanRTSubscribeHeader and VbanRTRequestHeader properties now return int type. They are then directly packed into the header.
This commit is contained in:
2026-03-09 05:19:41 +00:00
parent 98ec9b715f
commit 242401e294
4 changed files with 116 additions and 60 deletions

View File

@@ -1,6 +1,18 @@
from .packet.enums import ServiceTypes, SubProtocols
class VBANCMDError(Exception):
"""Base VBANCMD Exception class."""
class VBANCMDConnectionError(VBANCMDError):
"""Exception raised when connection/timeout errors occur"""
class VBANCMDPacketError(VBANCMDError):
"""Exception raised when packet parsing errors occur"""
def __init__(self, message: str, protocol: SubProtocols, type_: ServiceTypes):
super().__init__(message)
self.protocol = protocol
self.type = type_