[ios][storage] fixed issue where invalid file paths for download would error with unknown
This commit is contained in:
parent
2c2766f767
commit
f132ddb614
|
@ -22,10 +22,19 @@ RCT_EXPORT_MODULE(RNFirebaseStorage);
|
||||||
NSString *code = @"storage/unknown";
|
NSString *code = @"storage/unknown";
|
||||||
NSString *message = [error localizedDescription];
|
NSString *message = [error localizedDescription];
|
||||||
|
|
||||||
|
NSDictionary *userInfo = [error userInfo];
|
||||||
|
NSError *underlyingError = [userInfo objectForKey:NSUnderlyingErrorKey];
|
||||||
|
NSString *underlyingErrorDescription = [underlyingError localizedDescription];
|
||||||
|
|
||||||
switch (error.code) {
|
switch (error.code) {
|
||||||
case FIRStorageErrorCodeUnknown:
|
case FIRStorageErrorCodeUnknown:
|
||||||
code = @"storage/unknown";
|
if ([underlyingErrorDescription isEqualToString:@"The operation couldn’t be completed. Permission denied"]) {
|
||||||
message = @"An unknown error has occurred.";
|
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;
|
break;
|
||||||
case FIRStorageErrorCodeObjectNotFound:
|
case FIRStorageErrorCodeObjectNotFound:
|
||||||
code = @"storage/object-not-found";
|
code = @"storage/object-not-found";
|
||||||
|
|
Loading…
Reference in New Issue