Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ public void onSuccess(DeliveryVehicle deliveryVehicle) {
}

public void onFailure(@NonNull Throwable thrown) {
// TODO: Expose proper gRPC Error code to RN.
promise.reject(thrown);
promise.reject(
JsErrors.GET_DELIVERY_VEHICLE_ERROR_CODE,
JsErrors.GET_DELIVERY_VEHICLE_ERROR_MESSAGE,
thrown);
}
},
// causes the callbacks to be executed on the main (UI) thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ public class JsErrors {
public static final String DRIVER_API_NOT_INITIALIZED_CODE = "DRIVER_API_NOT_INITIALIZED_CODE";
public static final String DRIVER_API_NOT_INITIALIZED_MESSAGE =
"Driver API has not been initialized.";

public static final String GET_DELIVERY_VEHICLE_ERROR_CODE = "GET_DELIVERY_VEHICLE_ERROR_CODE";
public static final String GET_DELIVERY_VEHICLE_ERROR_MESSAGE =
"Failed to retrieve delivery vehicle information.";
}
3 changes: 1 addition & 2 deletions ios/DeliveryDriverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ - (void)getDeliveryVehicle:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseR
[_driverAPI.deliveryVehicleManager
getVehicleWithCompletion:^(GMTDDeliveryVehicle *_Nullable vehicle, NSError *_Nullable error) {
if (error != nil || vehicle == nil) {
reject(kDriverApiFailedToGetDeliveryVehicleCode,
kDriverApiFailedToGetDeliveryVehicleMessage, nil);
reject(kGetDeliveryVehicleErrorCode, kGetDeliveryVehicleErrorMessage, error);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions ios/JsErrorsConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ extern NSString* const kDriverApiAlreadyExistsErrorCode;
extern NSString* const kDriverApiAlreadyExistsErrorMessage;
extern NSString* const kNavigatorNotInitializedErrorCode;
extern NSString* const kNavigatorNotInitializedErrorMessage;
extern NSString* const kDriverApiFailedToGetDeliveryVehicleCode;
extern NSString* const kDriverApiFailedToGetDeliveryVehicleMessage;
extern NSString* const kGetDeliveryVehicleErrorCode;
extern NSString* const kGetDeliveryVehicleErrorMessage;
7 changes: 3 additions & 4 deletions ios/JsErrorsConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
NSString* const kDriverApiAlreadyExistsErrorMessage = @"Driver API already exists.";
NSString* const kNavigatorNotInitializedErrorCode = @"NO_NAVIGATOR_CODE";
NSString* const kNavigatorNotInitializedErrorMessage = @"Navigator is not initialized.";
NSString* const kDriverApiFailedToGetDeliveryVehicleCode =
@"DRIVER_API_FAILED_TO_GET_DELIVERY_VEHICLE";
NSString* const kDriverApiFailedToGetDeliveryVehicleMessage =
@"There was an error retrieving the delivery vehicle";
NSString* const kGetDeliveryVehicleErrorCode = @"GET_DELIVERY_VEHICLE_ERROR_CODE";
NSString* const kGetDeliveryVehicleErrorMessage =
@"Failed to retrieve delivery vehicle information.";