Skip to content

Commit

Permalink
Replaces status 204 by status 400 when no path can be found
Browse files Browse the repository at this point in the history
  • Loading branch information
JustineFricou committed May 13, 2024
1 parent 5e79931 commit e3bdca4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions geotrek/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,11 @@ def route_geometry(self, request, *args, **kwargs):
try:
path_router = PathRouter()
response = path_router.get_route(steps)
status = 200 if response is not None else 204

if response is not None:
status = 200
else:
response = {'error': 'No path between the given points'}
status = 400
except Exception as exc:
response, status = {'error': '%s' % exc, }, 500
return Response(response, status)
Expand Down

0 comments on commit e3bdca4

Please sign in to comment.