diff --git a/pygeoapi/api/__init__.py b/pygeoapi/api/__init__.py index b5e24641b..b8adc0ce1 100644 --- a/pygeoapi/api/__init__.py +++ b/pygeoapi/api/__init__.py @@ -1670,7 +1670,7 @@ def evaluate_limit(requested: Union[None, int], server_limits: dict, if requested2 <= 0: raise ValueError('limit value should be strictly positive') elif requested2 > max_ and on_exceed == 'error': - raise RuntimeError('Limit exceeded; throwing errror') + raise ValueError(f'Limit of {max_} exceeded') else: LOGGER.debug('limit requested') return min(requested2, max_) diff --git a/tests/api/test_api.py b/tests/api/test_api.py index 70f810840..de39a5d92 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -879,7 +879,7 @@ def test_evaluate_limit(): collection = {} server = {'default_items': 2, 'max_items': 3, 'on_exceed': 'error'} - with pytest.raises(RuntimeError): + with pytest.raises(ValueError): assert evaluate_limit('40', server, collection) == 40 collection = {'default_items': 10}