Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlocalized error when requesting route between waypoints that are too far apart #514

Open
dmiluski opened this issue Jan 27, 2021 · 1 comment
Labels
blocked Blocked by dependency or unclarity. jira-sync-complete localization

Comments

@dmiluski
Copy link

dmiluski commented Jan 27, 2021

To provide better feedback to our users, we are using DirectionError to display actionable feedback to users when they have created a route that is not routable.

Example
Screen Shot 2021-01-27 at 3 08 51 PM

Unfortunately, this uses a static string to display content which assumes km. On searching GitHub, I haven't been able to find the source of this text, so assuming it is being returned

invalidInput(message: Optional("Total distance between all coordinates cannot exceed 10000km"))

Ideally, we would either be able to:

  • Localize the distance formatting by use of a DistanceFormatter (respecting device preference)
    or
  • Define a known error case, where the App or SDK could format the distance based on user preference

Given the result appears to represent any input error, it's unlikely an app could perform this inference alone.

@1ec5
Copy link
Contributor

1ec5 commented Jan 28, 2021

This message comes from the Directions API. In some cases, this library does use other fields in the error JSON or HTTP headers to compose its own localizable error message. Unfortunately, in the case of a request like https://api.mapbox.com/directions/v5/mapbox/driving-traffic/-146.95,61.61;-70.66,-46.32.json?overview=false&steps=true&access_token=pk.…, the response contains just this body with no machine-readable distance in the JSON or HTTP headers:

{"message":"Total distance between all coordinates cannot exceed 10000km","code":"InvalidInput"}

In fact, the library doesn’t even know that it’s a too-long error because that information isn’t communicated to the client. In theory, we could parse the message for this sentence and convert the distance ourselves, but that would introduce a tight coupling to a detail of the API that may change without notice.

/cc @mapbox/navigation-api

@1ec5 1ec5 added blocked Blocked by dependency or unclarity. localization labels Jan 28, 2021
@1ec5 1ec5 changed the title Localize Distance Error Unlocalized error when requesting route between waypoints that are too far apart Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by dependency or unclarity. jira-sync-complete localization
Projects
None yet
Development

No branches or pull requests

3 participants