mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-24 23:39:37 +02:00
fix: improve error handling for Overpass API connection failures
This commit is contained in:
parent
e9084db832
commit
75162bbf7b
1 changed files with 2 additions and 2 deletions
|
@ -24,8 +24,8 @@ class OverpassViewSet(viewsets.ViewSet):
|
|||
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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue