From 9e140f1a7dc59aab3e5bbd5c51fd1aebc634c142 Mon Sep 17 00:00:00 2001 From: Robert Quattlebaum Date: Sat, 7 May 2011 11:08:27 -0700 Subject: [PATCH] Report an error when an attempt to open a repo throws something. --- PBGitRepository.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PBGitRepository.m b/PBGitRepository.m index 41bc6f0..8f0f92c 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -118,6 +118,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; //this works much better. - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { + @try { if (![PBGitBinary path]) { if (outError) { @@ -153,6 +154,14 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; [self setFileURL:gitDirURL]; [self setup]; return YES; + } @catch(id x) { + if (outError) { + NSDictionary* userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"An error occured while trying to open %@.\n%@", [self fileURL],x] + forKey:NSLocalizedRecoverySuggestionErrorKey]; + *outError = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:userInfo]; + } + return NO; + } } - (void) setup