🐛 Fix invalid line id returned by /stop/{stop_id}/nextPassages endpoint
This commit is contained in:
@@ -199,11 +199,12 @@ async def get_next_passages(stop_id: int) -> NextPassagesSchema | None:
|
||||
|
||||
# re.match will return None if the given journey.LineRef.value is not valid.
|
||||
try:
|
||||
line_id = IdfmInterface.LINE_RE.match(journey.LineRef.value).group(1)
|
||||
except AttributeError as exc:
|
||||
line_id_match = IdfmInterface.LINE_RE.match(journey.LineRef.value)
|
||||
line_id = int(line_id_match.group(1)) # type: ignore
|
||||
except (AttributeError, TypeError, ValueError) as err:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f'Line "{journey.LineRef.value}" not found'
|
||||
) from exc
|
||||
) from err
|
||||
|
||||
call = journey.MonitoredCall
|
||||
|
||||
|
Reference in New Issue
Block a user