[ios][storage] fixed issue where invalid file paths for download would error with unknown

This commit is contained in:
Salakar 2017-03-22 23:20:02 +00:00
parent 2c2766f767
commit f132ddb614
1 changed files with 11 additions and 2 deletions

View File

@ -22,10 +22,19 @@ RCT_EXPORT_MODULE(RNFirebaseStorage);
NSString *code = @"storage/unknown";
NSString *message = [error localizedDescription];
NSDictionary *userInfo = [error userInfo];
NSError *underlyingError = [userInfo objectForKey:NSUnderlyingErrorKey];
NSString *underlyingErrorDescription = [underlyingError localizedDescription];
switch (error.code) {
case FIRStorageErrorCodeUnknown:
code = @"storage/unknown";
message = @"An unknown error has occurred.";
if ([underlyingErrorDescription isEqualToString:@"The operation couldnt be completed. Permission denied"]) {
code = @"storage/invalid-device-file-path";
message = @"The specified device file path is invalid or is restricted.";
} else {
code = @"storage/unknown";
message = @"An unknown error has occurred.";
}
break;
case FIRStorageErrorCodeObjectNotFound:
code = @"storage/object-not-found";