Improved error handling

This commit is contained in:
Sven Heidemann 2021-07-27 10:59:24 +02:00
parent f8bd86692e
commit 45733b30ef
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,12 @@
from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument
from cpl_query.extension.iterable_abc import IterableABC
def contains_query(_list: IterableABC, value: object) -> bool:
return value in _list
def contains_query(_list: IterableABC, _value: object) -> bool:
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)
if _value is None:
raise ArgumentNoneException(ExceptionArgument.value)
return _value in _list

View File

@ -6,6 +6,7 @@ class ExceptionArgument(Enum):
list = 'list'
func = 'func'
type = 'type'
value = 'value'
# exceptions