Skip to content

Commit 102c843

Browse files
committed
feat: Add error handling.
1 parent 16b9043 commit 102c843

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

ios/RNTransportLocation.m

+15-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ +(BOOL)requiresMainQueueSetup
2626
reject:(RCTPromiseRejectBlock)reject)
2727
{
2828
[_mapService openServiceWithAppId:appId appSecurity:appSecurity enterpriseSenderCode:enterpriseSenderCode environment:environment listener:^(id model, NSError * error) {
29-
resolve(model);
29+
if (error) {
30+
reject(@"-14001", error.localizedDescription, error);
31+
} else {
32+
resolve(model);
33+
}
3034
}];
3135
}
3236

@@ -35,7 +39,11 @@ +(BOOL)requiresMainQueueSetup
3539
reject:(RCTPromiseRejectBlock)reject)
3640
{
3741
[_mapService startLocationWithShippingNoteInfos:shippingNoteInfos listener:^(id _Nonnull model, NSError * _Nonnull error) {
38-
resolve(model);
42+
if (error) {
43+
reject(@"-14002", error.localizedDescription, error);
44+
} else {
45+
resolve(model);
46+
}
3947
}];
4048
}
4149

@@ -44,7 +52,11 @@ +(BOOL)requiresMainQueueSetup
4452
reject:(RCTPromiseRejectBlock)reject)
4553
{
4654
[_mapService stopLocationWithShippingNoteInfos:shippingNoteInfos listener:^(id _Nonnull model, NSError * _Nonnull error) {
47-
resolve(model);
55+
if (error) {
56+
reject(@"-14003", error.localizedDescription, error);
57+
} else {
58+
resolve(model);
59+
}
4860
}];
4961
}
5062

0 commit comments

Comments
 (0)