2023-04-15 10:30:55 +00:00
|
|
|
class SettingException(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class SettingNotFound(SettingException):
|
|
|
|
def __init__(self, setting_name: str):
|
|
|
|
self.setting_name = setting_name
|
|
|
|
|
2023-04-15 10:35:11 +00:00
|
|
|
def __str__(self):
|
|
|
|
return f"Setting '{self.setting_name}' not found."
|
|
|
|
|
2023-04-15 10:30:55 +00:00
|
|
|
|
|
|
|
class SettingValueError(SettingException):
|
|
|
|
def __init__(self, setting_name: str, setting_value: str, rule: str):
|
|
|
|
"""
|
|
|
|
The rule has to be such, that the following format makes sense:
|
|
|
|
{name} {rule}, not '{value}'
|
|
|
|
|
|
|
|
:param setting_name:
|
|
|
|
:param setting_value:
|
|
|
|
:param rule:
|
|
|
|
"""
|
|
|
|
self.setting_name = setting_name
|
|
|
|
self.setting_value = setting_value
|
|
|
|
self.rule = rule
|
|
|
|
|
|
|
|
def __str__(self):
|
2023-04-15 10:42:12 +00:00
|
|
|
return f"{self.setting_name} {self.rule}, not '{self.setting_value}'."
|