Open Guardiola31337 opened 3 years ago
Capturing more feedback on the topic.
Also depending on how the service handles it, other possible error reasons could be:
- if maximum route length (if there is one?) for a walking or driving route is exceeded
- if the start and end points of the route are the same (with no waypoints in-between) basically any problems with the route that we should message the client about
cc @mapbox/navigation-ios
In Swift, this code associates Directions API error codes with enumeration values that are included in the callback for route requests.
Re-opening here https://github.com/mapbox/mapbox-navigation-android/pull/4577#issue-684553741
The next steps are to expose the Directions API error codes as string defs or enums to fully close https://github.com/mapbox/mapbox-navigation-android/issues/4376, and make the similar refresh interfaces internal and hidden since they are not used outside of the SDK scope.
Currently, we're reporting back a
Throwable
with a tweaked message as a result of https://github.com/mapbox/mapbox-navigation-android/blob/306f2919494f7731a0b3515a9d3d9cae5bd0ad07/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt#L386-L389 https://github.com/mapbox/mapbox-navigation-android/blob/306f2919494f7731a0b3515a9d3d9cae5bd0ad07/libnavigation-core/src/main/java/com/mapbox/navigation/core/directions/session/RoutesRequestCallback.kt#L34Clients can parse the string
Throwable.message
or print the whole thing but there isn't an easy way to tell the user the reason e.g. if it was offline or service error:This can't be easily implemented with given information from the
Throwable
.This ticket tracks the feature request of adding some kind of
Error
object including theReason
so that developers can use this extra information to act accordingly to their use cases (e.g. to determine what messaging to display).Reason
s may include offline vs service error, authentication failure, bad request, etc.cc @mapbox/navigation-android