Ability to report specific unarchiving error

This commit is contained in:
Kornel Lesiński committed 2016-12-21 15:22:59 +01:00
1 parent 311ed493b4
commit 23b2b49663
5 files changed
+10 -11

No files matched your search

+1 -2
View File
@@ -74,8 +74,7 @@
[self notifyDelegateOfSuccess];
}
else {
SULog(@"Applying delta patch failed with error: %@", applyDiffError);
[self notifyDelegateOfFailure];
[self unarchiverDidFailWithError:applyDiffError];
}
}
}
+1 -2
View File
@@ -135,7 +135,6 @@
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
{
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
goto reportError;
}
}
@@ -144,7 +143,7 @@
goto finally;
reportError:
[self notifyDelegateOfFailure];
[self unarchiverDidFailWithError:error];
finally:
if (mountedSuccessfully) {
+6 -5
View File
@@ -61,7 +61,7 @@
{
// *** GETS CALLED ON NON-MAIN THREAD!!!
@autoreleasepool {
NSError *error = nil;
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
SULog(@"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
@@ -107,16 +107,17 @@
[self notifyDelegateOfSuccess];
return;
} else {
SULog(@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength);
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
}
} else {
SULog(@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]);
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
}
} else {
SULog(@"Extraction failed, archive '%@' is empty", self.archivePath);
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
}
[self notifyDelegateOfFailure];
[self unarchiverDidFailWithError:error];
}
}
+1 -1
View File
@@ -76,7 +76,7 @@
});
}
- (void)notifyDelegateOfFailure
- (void)unarchiverDidFailWithError:(NSError *)error
{
dispatch_async(dispatch_get_main_queue(), ^{
if ([self.delegate respondsToSelector:@selector(unarchiverDidFail:)]) {
+1 -1
View File
@@ -20,7 +20,7 @@
- (void)notifyDelegateOfProgress:(double)progress;
- (void)notifyDelegateOfSuccess;
- (void)notifyDelegateOfFailure;
- (void)unarchiverDidFailWithError:(NSError *)error;
@end
#endif