CRREL / GRiD-API

9 stars 3 forks source link

Improve error handling #11

Closed jyutzler closed 8 years ago

jyutzler commented 8 years ago

Invalid requests nevertheless return a 200. For example:

https://gridte.rsgis.erdc.dren.mil/te_ba/api/v1/geoname/?source=[...]&geom=FOO

returns a 200 with the following payload:

{"status": "failure", "GRiD API": {"API Version": "v1"}, "error": "Please provide a valid WKT geometry."}

Better would be to return a 400 in this case. If that is not possible, at least update the API documents to indicate that invalid requests will return an Error Object. (The schema of this object is not documented in v1.)

trevorskaggs commented 8 years ago

Added object: https://github.com/CRREL/GRiD-API/commit/43f3edfe030eeadf2d033932c6ac78ba61406ec8#diff-a21d7b88c6e4ac5f0dd5b71fab0bfbd2R123