Skip to content

Commit aaec2c7

Browse files
authored
Merge pull request joltup#220 from TheAlmightyBob/ReportWriteFileError
Include failure reason in error from writeFile on iOS
2 parents 08ccf28 + 1c2964a commit aaec2c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ios/ReactNativeBlobUtilFS.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ + (void) writeFile:(NSString *)path
411411
[fileHandle closeFile];
412412
}
413413
else {
414-
if (![content writeToFile:path atomically:YES]) {
414+
if (![content writeToFile:path options:NSDataWritingAtomic error:&err]) {
415415
fm = nil;
416-
return reject(@"EUNSPECIFIED", [NSString stringWithFormat:@"File '%@' could not be written.", path], nil);
416+
return reject(@"EUNSPECIFIED", [NSString stringWithFormat:@"File '%@' could not be written; error: %@", path, [err description]], err);
417417
}
418418
}
419419
fm = nil;

0 commit comments

Comments
 (0)