diff --git a/src/traveltime_google_comparison/requests/here_handler.py b/src/traveltime_google_comparison/requests/here_handler.py index 9c5a9c9..0cc9804 100644 --- a/src/traveltime_google_comparison/requests/here_handler.py +++ b/src/traveltime_google_comparison/requests/here_handler.py @@ -62,6 +62,14 @@ async def send_request( for section in first_route["sections"] ) + # For some reason, HERE provider returns 0 duration, 0 length + # for some routes in the mountains, but doesn't indicate anywhere + # that it failed. Returning 0 fails `asType(int)` conversion later. + # Example route in UK where this happens: + # "58.61966879999991, -5.0040819999999995","58.578906999999894, -4.880025099999999" + if total_duration == 0: + return RequestResult(None) + return RequestResult(travel_time=total_duration) else: error_message = data.get("detailedError", "")