diff --git a/footprints/main/utils.py b/footprints/main/utils.py index d782b0fed..0db90d1c2 100644 --- a/footprints/main/utils.py +++ b/footprints/main/utils.py @@ -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']))