diff --git a/Sparkle/SUBinaryDeltaUnarchiver.m b/Sparkle/SUBinaryDeltaUnarchiver.m index 30c51f05..04aba6ff 100644 --- a/Sparkle/SUBinaryDeltaUnarchiver.m +++ b/Sparkle/SUBinaryDeltaUnarchiver.m @@ -74,8 +74,7 @@ [self notifyDelegateOfSuccess]; } else { - SULog(@"Applying delta patch failed with error: %@", applyDiffError); - [self notifyDelegateOfFailure]; + [self unarchiverDidFailWithError:applyDiffError]; } } } diff --git a/Sparkle/SUDiskImageUnarchiver.m b/Sparkle/SUDiskImageUnarchiver.m index 68f3f2e6..40b69fce 100644 --- a/Sparkle/SUDiskImageUnarchiver.m +++ b/Sparkle/SUDiskImageUnarchiver.m @@ -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) { diff --git a/Sparkle/SUPipedUnarchiver.m b/Sparkle/SUPipedUnarchiver.m index aebc5b46..6b7373e9 100644 --- a/Sparkle/SUPipedUnarchiver.m +++ b/Sparkle/SUPipedUnarchiver.m @@ -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]; } } diff --git a/Sparkle/SUUnarchiver.m b/Sparkle/SUUnarchiver.m index c65c5166..1b8d292a 100644 --- a/Sparkle/SUUnarchiver.m +++ b/Sparkle/SUUnarchiver.m @@ -76,7 +76,7 @@ }); } -- (void)notifyDelegateOfFailure +- (void)unarchiverDidFailWithError:(NSError *)error { dispatch_async(dispatch_get_main_queue(), ^{ if ([self.delegate respondsToSelector:@selector(unarchiverDidFail:)]) { diff --git a/Sparkle/SUUnarchiver_Private.h b/Sparkle/SUUnarchiver_Private.h index c29d68cf..f8853d1f 100644 --- a/Sparkle/SUUnarchiver_Private.h +++ b/Sparkle/SUUnarchiver_Private.h @@ -20,7 +20,7 @@ - (void)notifyDelegateOfProgress:(double)progress; - (void)notifyDelegateOfSuccess; -- (void)notifyDelegateOfFailure; +- (void)unarchiverDidFailWithError:(NSError *)error; @end #endif