You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
The text was updated successfully, but these errors were encountered:
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.
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.
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:
or
Given the result appears to represent any input error, it's unlikely an app could perform this inference alone.
The text was updated successfully, but these errors were encountered: