-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return a 400 status code for an "out-of-range" get tile request #1503
Conversation
…t for a tile out of range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doublebyte1 does the problem apply to the rest of the MVT provider implementations like for example mvt_tippecanoe
?
@francbartoli MVT-tippecanoe looks for the tile on disk, instead of issuing a request to a server. When it does not find it, it throws a FileNotFound/404 error, which complies with the spec.
|
- if the status code is bellow 500, it throws a ProviderInvalidQueryError (status code 404) - otherwise it throws a server error (status code 500) - the api catching of errors is left as it was before, as the appropriated status code is being sent by the provider.
pygeoapi/provider/mvt_elastic.py
Outdated
return resp.content | ||
except requests.exceptions.RequestException as e: | ||
LOGGER.debug(e) | ||
if resp.status_code <= 500: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think < 500
is meant here instead of <= 500
, otherwise internal server errors would be reported as invalid client errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Well spotted!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totycro fixed on my latest commit
…nses with a status of 500 from throwing a client error
@doublebyte1 if I'm not wrong pygeoapi supported tippecanoe built tiles which might be hosted remotely on s3-like (i.e. Minio, etc) buckets |
@francbartoli I addressed this issue on a separate PR: #1507 |
Overview
The MVT-elastic backend provider returns a 400 status code in response to a request for a tile out of range (e.g.: outside the limits of the TMS). This would satisfy req 6 A of the OGC API - Tiles standard (requirements class core). However, pygeoapi is transforming this into a 500 error.
This PR introduces a try/ except block on the MVT-elastic class, and makes sure that the Exception that arrives to the API class is appropriated. For that purpose, I reused the existing "ProviderInvalidQueryError", which is close enough in terms of semantics, but I could also have created a new Provider exception.
Related issue / discussion
#1502
Additional information
OGC API - Tiles standard: https://docs.ogc.org/is/20-057/20-057.html
Dependency policy (RFC2)
Updates to public demo
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)