mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-04-18 04:53:31 +00:00
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:
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user