Merge pull request #6743 from electron/recovery-suggestion

Add recovery suggestion to auto update failure string
This commit is contained in:
Cheng Zhao 2016-08-08 16:02:13 +09:00 committed by GitHub
commit fd461cdd27

View file

@ -104,11 +104,18 @@ void AutoUpdater::CheckForUpdates() {
delegate->OnUpdateNotAvailable();
}
} error:^(NSError *error) {
NSString* failureString = error.localizedFailureReason ?
[NSString stringWithFormat:@"%@: %@",
error.localizedDescription,
error.localizedFailureReason] :
[NSString stringWithString:error.localizedDescription];
NSMutableString* failureString =
[NSMutableString stringWithString:error.localizedDescription];
if (error.localizedFailureReason) {
[failureString appendString:@": "];
[failureString appendString:error.localizedFailureReason];
}
if (error.localizedRecoverySuggestion) {
if (![failureString hasSuffix:@"."])
[failureString appendString:@"."];
[failureString appendString:@" "];
[failureString appendString:error.localizedRecoverySuggestion];
}
delegate->OnError(base::SysNSStringToUTF8(failureString));
}];
}