Handle exceptions in search method with a generic error message
This commit is contained in:
@@ -42,8 +42,8 @@ class ReverseGeocodeViewSet(viewsets.ViewSet):
|
|||||||
else:
|
else:
|
||||||
results = search_osm(query)
|
results = search_osm(query)
|
||||||
return Response(results)
|
return Response(results)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
return Response({"error": str(e)}, status=500)
|
return Response({"error": "An internal error occurred while processing the request"}, status=500)
|
||||||
|
|
||||||
@action(detail=False, methods=['post'])
|
@action(detail=False, methods=['post'])
|
||||||
def mark_visited_region(self, request):
|
def mark_visited_region(self, request):
|
||||||
|
|||||||
Reference in New Issue
Block a user