Handle exceeding the limit gracefully#2067
Merged
tomkralidis merged 2 commits intogeopython:masterfrom Jul 20, 2025
Merged
Conversation
Will now return a 400 to the user with info what the limit was that caused the error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Will now return a 400 to the user with info on what the limit was that caused the error.
Overview
Currently, if a user inputs a limit that exceeds the value in the
server.limitsconfiguration variable and the value ofon_exceediserror, aRunimeErrorwill be returned. This is not ideal as it causes a 500 error to be returned to the user with no information on what caused it.Suggested fix in this pr:
Change from a
RuntimeErrorto aValueError, asValueErroris already being handled to ensure that the limit is a positive number. This will also return a 400 to the user, notifying them of the limit so they can adjust their queries.Related Issue / discussion
There is no existing issue for this. However, as it was a one line change, I consider it "trivial", and assume the discussion can happen here.
Dependency policy (RFC2)
Updates to public demo
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)