40 lines
749 B
Python
40 lines
749 B
Python
from enum import Enum
|
|
|
|
|
|
# models
|
|
class ExceptionArgument(Enum):
|
|
list = 'list'
|
|
func = 'func'
|
|
type = 'type'
|
|
value = 'value'
|
|
index = 'index'
|
|
|
|
|
|
# exceptions
|
|
class ArgumentNoneException(Exception):
|
|
r"""Exception when argument is None
|
|
"""
|
|
|
|
def __init__(self, arg: ExceptionArgument):
|
|
Exception.__init__(self, f'argument {arg} is None')
|
|
|
|
|
|
class IndexOutOfRangeException(Exception):
|
|
r"""Exception when index is out of range
|
|
"""
|
|
|
|
def __init__(self):
|
|
Exception.__init__(self, f'List index out of range')
|
|
|
|
|
|
class InvalidTypeException(Exception):
|
|
r"""Exception when type is invalid
|
|
"""
|
|
pass
|
|
|
|
|
|
class WrongTypeException(Exception):
|
|
r"""Exception when type is unexpected
|
|
"""
|
|
pass
|