Feature/initial (#1)

* initial commit
* systemd service implementation
This commit is contained in:
echoDaveD
2025-02-11 20:47:47 +01:00
committed by GitHub
parent 90b74d1b51
commit b2cd11f129
20 changed files with 9317 additions and 1 deletions

64
EHSExceptions.py Normal file
View File

@@ -0,0 +1,64 @@
class EHSException(Exception):
"""Base class for exceptions in this module."""
pass
class MessageWarningException(EHSException):
"""Exception raised by message errors.
Attributes:
message -- explanation of the error
"""
def __init__(self, argument, message):
self.argument = argument
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.message}: {self.argument}'
class ConfigException(EHSException):
"""Exception raised by multiple Config errors.
Attributes:
message -- explanation of the error
"""
def __init__(self, argument, message="Config Parameter Exception: "):
self.argument = argument
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.message}: {self.argument}'
class ArgumentException(EHSException):
"""Exception raised by multiple Arguments errors.
Attributes:
message -- explanation of the error
"""
def __init__(self, argument, message="Argument is missing"):
self.argument = argument
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.argument} -> {self.message}'
class InvalidMessageTypeException(EHSException):
"""Exception raised for invalid message types.
Attributes:
message_type -- input message type which caused the error
message -- explanation of the error
"""
def __init__(self, message_type, message="Invalid message type provided"):
self.message_type = message_type
self.message = message
super().__init__(self.message)
def __str__(self):
return f'{self.message_type} -> {self.message}'