0DMRMaster version 0.5
Этот коммит содержится в:
@@ -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}"
|
||||
|
||||
Ссылка в новой задаче
Block a user