Skip to content

Commit 0dd5b06

Browse files
authored
pass NSUnderlyingError to client (#10453)
1 parent 67804b8 commit 0dd5b06

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

FirebaseRemoteConfig/Sources/RCNConfigFetch.m

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,17 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
233233
FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000073", @"%@",
234234
[NSString stringWithFormat:@"%@", errorDescription]);
235235
strongSelf->_settings.isFetchInProgress = NO;
236+
237+
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
238+
userInfo[NSLocalizedDescriptionKey] = errorDescription;
239+
userInfo[NSUnderlyingErrorKey] = error.userInfo[NSUnderlyingErrorKey];
240+
236241
return [strongSelf
237242
reportCompletionOnHandler:completionHandler
238243
withStatus:FIRRemoteConfigFetchStatusFailure
239244
withError:[NSError errorWithDomain:FIRRemoteConfigErrorDomain
240245
code:FIRRemoteConfigErrorInternalError
241-
userInfo:@{
242-
NSLocalizedDescriptionKey : errorDescription
243-
}]];
246+
userInfo:userInfo]];
244247
}
245248

246249
// We have a valid token. Get the backing installationID.
@@ -265,18 +268,20 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
265268
if (!identifier || error) {
266269
NSString *errorDescription =
267270
[NSString stringWithFormat:@"Error getting iid : %@.", error];
271+
272+
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
273+
userInfo[NSLocalizedDescriptionKey] = errorDescription;
274+
userInfo[NSUnderlyingErrorKey] = error.userInfo[NSUnderlyingErrorKey];
275+
268276
FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000055", @"%@",
269277
[NSString stringWithFormat:@"%@", errorDescription]);
270278
strongSelfQueue->_settings.isFetchInProgress = NO;
271279
return [strongSelfQueue
272280
reportCompletionOnHandler:completionHandler
273281
withStatus:FIRRemoteConfigFetchStatusFailure
274-
withError:[NSError
275-
errorWithDomain:FIRRemoteConfigErrorDomain
276-
code:FIRRemoteConfigErrorInternalError
277-
userInfo:@{
278-
NSLocalizedDescriptionKey : errorDescription
279-
}]];
282+
withError:[NSError errorWithDomain:FIRRemoteConfigErrorDomain
283+
code:FIRRemoteConfigErrorInternalError
284+
userInfo:userInfo]];
280285
}
281286

282287
FIRLogInfo(kFIRLoggerRemoteConfig, @"I-RCN000022", @"Success to get iid : %@.",

0 commit comments

Comments
 (0)