Handle Consumer SDK Errors
The Consumer SDK sends trip update errors to the consumer app using a callback
mechanism. The callback parameter is a platform-specific return type (
TripUpdateError
on Android, and
NSError
on iOS).
Extract status codes
The errors passed to the callback are typically gRPC errors, and you can also extract additional information from them in the form of a status code. For the complete list of status codes, see Status codes and their use in gRPC.
Interpret status codes
Status codes cover two kinds of errors: server and network-related errors, and client-side errors.
Server and network errors
The following status codes are for either network or server errors, and you don't need to any take action to resolve them. The Consumer SDK automatically recovers from them.
Status Code | Description |
---|---|
ABORTED | The server stopped sending the response. This is normally caused by a server problem. |
CANCELLED | The server terminated the outgoing response. This normally
happens when
the app is sent to the background, or when there is a state change in the Consumer app. |
INTERRUPTED | |
DEADLINE_EXCEEDED | The server took too long to respond. |
UNAVAILABLE | The server was unavailable. This is normally caused by a network problem. |
Client errors
The following status codes are for client errors, and you must take action to resolve them. The Consumer SDK continues retrying to refresh the trip until you end journey sharing, but it won't recover until you take action.
Status Code | Description |
---|---|
INVALID_ARGUMENT | The Consumer app specified an invalid trip name; The trip name must
follow the format providers/{provider_id}/trips/{trip_id} .
|
NOT_FOUND | The trip was never created. |
PERMISSION_DENIED | The Consumer app has insufficient permissions. This error occurs when:
|
RESOURCE_EXHAUSTED | The resource quota is at zero, or the rate of traffic flow exceeds the speed limit. |
UNAUTHENTICATED | The request failed authentication due to an invalid JWT token. This error occurs either when the JWT token is signed without a trip ID, or when the JWT token has expired. |