Этот коммит содержится в:
Alexander UR6LKW
2025-05-31 19:11:26 +03:00
родитель a3b486071d
Коммит 07aa4efb2d
16 изменённых файлов: 280 добавлений и 155 удалений
+33 -6
Просмотреть файл
@@ -1,3 +1,6 @@
from abc import ABC, abstractmethod
class DMRPFieldOutOfRangeException(Exception):
"""
Exception raised when a packet field value is out of the allowed or expected range.
@@ -14,18 +17,17 @@ class DMRPBadPacketException(Exception):
"""
Exception raised when a packet is structurally invalid or corrupted
"""
pass
...
class DMRPL2BadDataException(Exception):
"""
Exception raised when L2 data is invalid or corrupted.
"""
pass
...
class FactoryException(Exception):
pass
...
class DMRPUnknownPacketTypeException(FactoryException):
@@ -33,7 +35,7 @@ class DMRPUnknownPacketTypeException(FactoryException):
Exception raised when the packet factory cannot recognize the packet type
from the given input data.
"""
pass
...
class DMRPUnknownLCTypeException(FactoryException):
@@ -41,6 +43,31 @@ class DMRPUnknownLCTypeException(FactoryException):
Exception raised when the lc analyzer factory cannot recognize the
lc type from the given input data.
"""
pass
...
class CustomMessageException(Exception, ABC):
@classmethod
@abstractmethod
def create_message(cls, msg: str) -> str: ...
def __init__(self, msg: str):
super().__init__(self.__class__.create_message(msg))
class EmbLCAssemblerException(CustomMessageException):
"""
Exception raised on EmbLCAssembler error
"""
@classmethod
def create_message(cls, msg: str) -> str:
return f"Embedded LC failed: {msg}"
class CallLCDecoderException(CustomMessageException):
"""
Exception raised on CallLCDecoder error
"""
@classmethod
def create_message(cls, msg: str) -> str:
return f"In-call LC decoder failed: {msg}"