2021-07-27 09:41:51 +02:00
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
|
|
|
|
# models
|
|
|
|
class ExceptionArgument(Enum):
|
|
|
|
list = 'list'
|
|
|
|
func = 'func'
|
|
|
|
type = 'type'
|
2021-07-27 10:59:24 +02:00
|
|
|
value = 'value'
|
2021-07-27 11:29:52 +02:00
|
|
|
index = 'index'
|
2021-07-27 09:41:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
# exceptions
|
|
|
|
class ArgumentNoneException(Exception):
|
2021-11-01 21:17:56 +01:00
|
|
|
r"""Exception when argument is None
|
|
|
|
"""
|
2021-07-27 09:41:51 +02:00
|
|
|
|
|
|
|
def __init__(self, arg: ExceptionArgument):
|
2021-07-27 11:40:24 +02:00
|
|
|
Exception.__init__(self, f'argument {arg} is None')
|
|
|
|
|
|
|
|
|
|
|
|
class IndexOutOfRangeException(Exception):
|
2021-11-02 17:23:42 +01:00
|
|
|
r"""Exception when index is out of range
|
|
|
|
"""
|
2021-07-27 11:40:24 +02:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self, f'List index out of range')
|
2021-07-27 09:41:51 +02:00
|
|
|
|
|
|
|
|
2021-07-27 09:26:30 +02:00
|
|
|
class InvalidTypeException(Exception):
|
2021-11-02 17:23:42 +01:00
|
|
|
r"""Exception when type is invalid
|
|
|
|
"""
|
2021-07-27 09:26:30 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class WrongTypeException(Exception):
|
2021-11-02 17:23:42 +01:00
|
|
|
r"""Exception when type is unexpected
|
|
|
|
"""
|
2021-07-27 09:26:30 +02:00
|
|
|
pass
|