sh_cpl/src/cpl_query/exceptions.py

34 lines
599 B
Python
Raw Normal View History

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):
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):
pass
class WrongTypeException(Exception):
pass