diff --git a/lib/skate/open_route_service_api.ex b/lib/skate/open_route_service_api.ex index 1b45f84d6..f446896df 100644 --- a/lib/skate/open_route_service_api.ex +++ b/lib/skate/open_route_service_api.ex @@ -118,7 +118,7 @@ defmodule Skate.OpenRouteServiceAPI do 11 -> :depart 12 -> :keep_left 13 -> :keep_right - _ -> :error + value -> {:error, value} end end end diff --git a/lib/skate/open_route_service_api/directions_formatter/MBTA/english.ex b/lib/skate/open_route_service_api/directions_formatter/MBTA/english.ex index 870fc349f..4061bbbb2 100644 --- a/lib/skate/open_route_service_api/directions_formatter/MBTA/english.ex +++ b/lib/skate/open_route_service_api/directions_formatter/MBTA/english.ex @@ -2,6 +2,7 @@ defmodule Skate.OpenRouteServiceAPI.DirectionsFormatter.MBTA.English do @moduledoc """ Formats Directions from Open Route Service into MBTA English specific Directions Shorthand. """ + require Logger @doc """ Formats a Open Route Service Direction Instruction Map into @@ -18,9 +19,18 @@ defmodule Skate.OpenRouteServiceAPI.DirectionsFormatter.MBTA.English do # Converts ORS Instructions into string form, or `nil` # Ignore noisy instructions defp format_instruction(type, _name, _) - when type in [:goal, :depart, :straight, :error], + when type in [:goal, :depart, :straight], do: nil + # Ignore type errors + defp format_instruction({:error, value}, _name, attrs) do + Logger.error( + "Received :error, when formatting instruction, value=#{value} ors_attrs=#{inspect(attrs)}" + ) + + nil + end + # ORS uses `-` as a value when a direction doesn't have a name # Reject instructions without a name defp format_instruction(_type, "-", _),