Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1123 additional error handling: check status_code, keys
Browse files Browse the repository at this point in the history
gabrielwol committed Jan 2, 2025
1 parent 89d6bde commit bfe278e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gis/gccview/gcc_puller_functions.py
Original file line number Diff line number Diff line change
@@ -345,9 +345,17 @@ def get_data(mapserver, layer_id, max_number = None, record_max = None):
except requests.exceptions.RequestException as err:
LOGGER.error("Error: %s", err)
else:
if r.status_code != 200:
LOGGER.error("Query was not successful. Response: %s", r)
return_json = r.json()
break

keys = ['fields', 'features', 'geometryType']
for k in keys:
if not(k in return_json.keys()):
LOGGER.error("return_json: %s", return_json)
raise KeyError(f"Return json missing field: {k}")

return return_json

def find_limit(return_json):

0 comments on commit bfe278e

Please sign in to comment.