Skip to content

Commit

Permalink
Merge pull request #3248 from ccnmtl/FOOTPRINTS-590
Browse files Browse the repository at this point in the history
Make error clearer
  • Loading branch information
nikolas authored Nov 6, 2024
2 parents 1fc103e + e1f636b commit d91c943
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions footprints/main/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def get_geoname_by_id(self, gid):
'username={}&type=json&geonameId={}').format(
settings.GEONAMES_KEY, gid)
results = requests.get(url)

if results.status_code == 404:
raise ValueError(f"Geoname ID {gid} not found.")

the_json = results.json()

pt = Point(float(the_json['lng']), float(the_json['lat']))
Expand Down

0 comments on commit d91c943

Please sign in to comment.