mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-29 17:59:36 +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 = requests.get(url, headers=self.HEADERS)
|
||||||
response.raise_for_status() # Raise an exception for HTTP errors
|
response.raise_for_status() # Raise an exception for HTTP errors
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException:
|
||||||
return Response({"error": str(e)}, status=500)
|
return Response({"error": "Failed to connect to Overpass API"}, status=500)
|
||||||
except requests.exceptions.JSONDecodeError:
|
except requests.exceptions.JSONDecodeError:
|
||||||
return Response({"error": "Invalid response from Overpass API"}, status=400)
|
return Response({"error": "Invalid response from Overpass API"}, status=400)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue