From 75162bbf7ba07210409a8a1bdf97d1edb37b283d Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 17 Jan 2025 18:22:03 -0500 Subject: [PATCH] fix: improve error handling for Overpass API connection failures --- backend/server/adventures/views/overpass_view.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/server/adventures/views/overpass_view.py b/backend/server/adventures/views/overpass_view.py index a64e55b5..a72b4a79 100644 --- a/backend/server/adventures/views/overpass_view.py +++ b/backend/server/adventures/views/overpass_view.py @@ -24,8 +24,8 @@ def make_overpass_query(self, query): response = requests.get(url, headers=self.HEADERS) response.raise_for_status() # Raise an exception for HTTP errors return response.json() - except requests.exceptions.RequestException as e: - return Response({"error": str(e)}, status=500) + except requests.exceptions.RequestException: + return Response({"error": "Failed to connect to Overpass API"}, status=500) except requests.exceptions.JSONDecodeError: return Response({"error": "Invalid response from Overpass API"}, status=400)