Skip to content

Commit

Permalink
fix: improve error handling for Overpass API connection failures
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorley15 committed Jan 17, 2025
1 parent e9084db commit 75162bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/server/adventures/views/overpass_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 75162bb

Please sign in to comment.