Skip to content

Commit 743c531

Browse files
committed
When there is both a failure reason and a recovery suggestion, display both
1 parent 94da0b6 commit 743c531

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Classes/Views/PBGitXMessageSheet.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,20 @@ + (void)beginSheetWithError:(NSError *)error
4545
windowController:(PBGitWindowController *)windowController
4646
{
4747
PBGitXMessageSheet *sheet = [[self alloc] initWithWindowNibName:@"PBGitXMessageSheet" windowController:windowController];
48+
49+
NSString *infoText = nil;
50+
NSString *desc = error.localizedDescription;
51+
NSString *recovery = error.localizedRecoverySuggestion;
52+
if (desc && recovery) {
53+
infoText = [NSString stringWithFormat:@"%@\n\n%@", desc, recovery];
54+
} else if (desc) {
55+
infoText = desc;
56+
} else if (recovery) {
57+
infoText = recovery;
58+
}
59+
4860
[sheet beginMessageSheetWithMessageText:[error localizedDescription]
49-
infoText:[error localizedRecoverySuggestion]];
61+
infoText:infoText];
5062
}
5163

5264
- (IBAction)closeMessageSheet:(id)sender

0 commit comments

Comments
 (0)