Skip to content

Commit 9a53873

Browse files
lgourdingerome.perrin
andauthored
fix: Smart/Origin: garantie2: problem with navitia 404 identifiers (#2166)
* [refactor] Use of Elastic Search filters in reachable routes instead of filters in database * [fix] fix sort + when no results found * [fix] fix chunks size being above ES max result window * [fix] add a constant chunk_size instead to prevent circular import with document * [SQUASH][GP][improve] replace chunk size by ES_MAX_RESULT_WINDOW constant importing it in function * [fix] fix exceptions being thrown whenever navitia api adds a new 404 error_id --------- Co-authored-by: gerome.perrin <gerome.perrin@smart-origin.com>
1 parent 77ddaa5 commit 9a53873

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

c2corg_api/views/navitia.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -758,15 +758,9 @@ def handle_navitia_response(response):
758758
raise HTTPBadRequest("Invalid parameters for Navitia API")
759759

760760
elif response.status_code == 404:
761-
error_id = response.json().get("error", {}).get("id")
762-
763-
# Allowed "no journey found" cases
764-
if error_id in ("no_destination", "no_origin"):
765-
return None
766-
767-
# Raise with the payload as the detail
768-
raise HTTPInternalServerError(
769-
response.json().get("error", {}))
761+
# 404: unable to find an object, no response
762+
# This should not raise any exception error, just return None
763+
return None
770764

771765
elif not response.ok:
772766
raise HTTPInternalServerError(

0 commit comments

Comments
 (0)