From 0c5b49c402ecb3cb753e3404f214754d3904172f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 5 Aug 2016 09:24:13 -0700 Subject: [PATCH] Add recovery suggestion to failure string --- atom/browser/auto_updater_mac.mm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/atom/browser/auto_updater_mac.mm b/atom/browser/auto_updater_mac.mm index 1987f33621d..a6102f3e73f 100644 --- a/atom/browser/auto_updater_mac.mm +++ b/atom/browser/auto_updater_mac.mm @@ -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)); }]; }