From e1f636bf83ad9791b74102b96bdf7067ab0484fd Mon Sep 17 00:00:00 2001 From: ndittren <36773036+ndittren@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:32:45 -0400 Subject: [PATCH] Make error clearer --- footprints/main/utils.py | 4 ++++ 1 file changed, 4 insertions(+) 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']))