"""Custom error classes
"""
from loguru._logger import Logger
[docs]class CustomRuntimeError(RuntimeError):
"""Base class for other runtime exceptions
"""
[docs]class ComponentNameError(CustomRuntimeError):
"""Given name of component is wrong or name isn't unique.
"""
def __init__(self, name: str) -> None:
self.message = f'Stuff with {name=} is exist in ' + \
'Component class instance or wrong name of stuff.'
super().__init__(self.message)
[docs]class ComponentClassError(CustomRuntimeError):
"""Given class can't be a part of components.
"""
def __init__(self, obj_) -> None:
self.message = f'Given: {obj_} cant be used as part of Components.'
super().__init__(self.message)
[docs]class StuffDefineError(AttributeError):
"""Bad definition of item.
"""
def __init__(self, message: str, logger: Logger) -> None:
self.message = message
logger.exception(self.message)
super().__init__(self.message)
[docs]class ArrangeIndexError(IndexError):
"""Index error for arrange tool.
"""
def __init__(self, message: str, logger: Logger) -> None:
self.message = message
logger.exception(self.message)
super().__init__(self.message)