Skip to content

Commit 9e140f1

Browse files
committed
Report an error when an attempt to open a repo throws something.
1 parent 02d04c2 commit 9e140f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

PBGitRepository.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ + (NSURL*)baseDirForURL:(NSURL*)repositoryURL;
118118
//this works much better.
119119
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
120120
{
121+
@try {
121122
if (![PBGitBinary path])
122123
{
123124
if (outError) {
@@ -153,6 +154,14 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
153154
[self setFileURL:gitDirURL];
154155
[self setup];
155156
return YES;
157+
} @catch(id x) {
158+
if (outError) {
159+
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"An error occured while trying to open %@.\n%@", [self fileURL],x]
160+
forKey:NSLocalizedRecoverySuggestionErrorKey];
161+
*outError = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:userInfo];
162+
}
163+
return NO;
164+
}
156165
}
157166

158167
- (void) setup

0 commit comments

Comments
 (0)