Add recovery suggestion to failure string

This commit is contained in:
Kevin Sawicki 2016-08-05 09:24:13 -07:00
Родитель 5eeadb0ad4
Коммит 0c5b49c402
1 изменённых файлов: 12 добавлений и 5 удалений

Просмотреть файл

@ -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));
}];
}