Improved error handling
This commit is contained in:
parent
f8bd86692e
commit
45733b30ef
@ -1,5 +1,12 @@
|
|||||||
|
from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument
|
||||||
from cpl_query.extension.iterable_abc import IterableABC
|
from cpl_query.extension.iterable_abc import IterableABC
|
||||||
|
|
||||||
|
|
||||||
def contains_query(_list: IterableABC, value: object) -> bool:
|
def contains_query(_list: IterableABC, _value: object) -> bool:
|
||||||
return value in _list
|
if _list is None:
|
||||||
|
raise ArgumentNoneException(ExceptionArgument.list)
|
||||||
|
|
||||||
|
if _value is None:
|
||||||
|
raise ArgumentNoneException(ExceptionArgument.value)
|
||||||
|
|
||||||
|
return _value in _list
|
||||||
|
@ -6,6 +6,7 @@ class ExceptionArgument(Enum):
|
|||||||
list = 'list'
|
list = 'list'
|
||||||
func = 'func'
|
func = 'func'
|
||||||
type = 'type'
|
type = 'type'
|
||||||
|
value = 'value'
|
||||||
|
|
||||||
|
|
||||||
# exceptions
|
# exceptions
|
||||||
|
Loading…
Reference in New Issue
Block a user