mirror of
https://github.com/samsonjs/arq_restore.git
synced 2026-03-25 09:25:53 +00:00
print errors if any
This commit is contained in:
parent
b2f65289c4
commit
056002c5b9
3 changed files with 18 additions and 2 deletions
|
|
@ -238,6 +238,14 @@
|
|||
return NO;
|
||||
}
|
||||
printf("restored files are in %s\n", [bucketName fileSystemRepresentation]);
|
||||
NSDictionary *errorsByPath = [restorer errorsByPath];
|
||||
if ([errorsByPath count] > 0) {
|
||||
printf("Errors occurred:\n");
|
||||
NSArray *sortedKeys = [[errorsByPath allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||
for (NSString *key in sortedKeys) {
|
||||
printf("%s\t\t%s\n", [key UTF8String], [[[errorsByPath objectForKey:key] localizedDescription] UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,4 +56,5 @@
|
|||
}
|
||||
- (id)initWithRepo:(ArqRepo *)theRepo bucketName:(NSString *)theBucketName commitSHA1:(NSString *)theCommitSHA1;
|
||||
- (BOOL)restore:(NSError **)error;
|
||||
- (NSDictionary *)errorsByPath;
|
||||
@end
|
||||
|
|
|
|||
11
Restorer.m
11
Restorer.m
|
|
@ -75,6 +75,7 @@
|
|||
- (BOOL)createSymLink:(Node *)node path:(NSString *)symLinkFile target:(NSString *)target error:(NSError **)error;
|
||||
- (BOOL)applyACLBlobKey:(BlobKey *)aclBlobKey uncompress:(BOOL)uncompress toPath:(NSString *)path error:(NSError **)error;
|
||||
- (BOOL)applyXAttrsBlobKey:(BlobKey *)xattrsBlobKey uncompress:(BOOL)uncompress toFile:(NSString *)path error:(NSError **)error;
|
||||
- (void)addError:(NSError *)theError forPath:(NSString *)thePath;
|
||||
@end
|
||||
|
||||
@implementation Restorer
|
||||
|
|
@ -154,6 +155,9 @@
|
|||
}
|
||||
return YES;
|
||||
}
|
||||
- (NSDictionary *)errorsByPath {
|
||||
return errorsByPath;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation Restorer (internal)
|
||||
|
|
@ -203,7 +207,7 @@
|
|||
}
|
||||
break;
|
||||
}
|
||||
[self performSelectorOnMainThread:@selector(addError:) withObject:[NSArray arrayWithObjects:restoreError, childPath, nil] waitUntilDone:YES];
|
||||
[self addError:restoreError forPath:childPath];
|
||||
}
|
||||
} else {
|
||||
NSError *restoreError = nil;
|
||||
|
|
@ -216,7 +220,7 @@
|
|||
break;
|
||||
}
|
||||
HSLogDebug(@"error restoring %@: %@", childPath, restoreError);
|
||||
[self performSelectorOnMainThread:@selector(addError:) withObject:[NSArray arrayWithObjects:restoreError, childPath, nil] waitUntilDone:YES];
|
||||
[self addError:restoreError forPath:childPath];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -690,4 +694,7 @@
|
|||
}
|
||||
return YES;
|
||||
}
|
||||
- (void)addError:(NSError *)theError forPath:(NSString *)thePath {
|
||||
[errorsByPath setObject:theError forKey:thePath];
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
Loading…
Reference in a new issue