Improved index out of range exception

This commit is contained in:
2021-07-27 11:40:24 +02:00
parent a3a0a150a8
commit 82a9e3a23a
3 changed files with 12 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
from typing import Optional
from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument
from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException
from cpl_query.extension.iterable_abc import IterableABC
@@ -9,7 +9,7 @@ def first_query(_list: IterableABC) -> any:
raise ArgumentNoneException(ExceptionArgument.list)
if len(_list) == 0:
raise Exception('Index out of range')
raise IndexOutOfRangeException()
return _list[0]