Catch the exception thrown from Squirrel
This commit is contained in:
parent
665363b356
commit
ee71b2044e
1 changed files with 11 additions and 5 deletions
|
@ -36,15 +36,21 @@ void RelaunchToInstallUpdate() {
|
|||
// static
|
||||
void AutoUpdater::SetFeedURL(const std::string& feed) {
|
||||
if (g_updater == nil) {
|
||||
// Initialize the SQRLUpdater.
|
||||
NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)];
|
||||
NSURLRequest* urlRequest = [NSURLRequest requestWithURL:url];
|
||||
g_updater = [[SQRLUpdater alloc] initWithUpdateRequest:urlRequest];
|
||||
|
||||
AutoUpdaterDelegate* delegate = GetDelegate();
|
||||
if (!delegate)
|
||||
return;
|
||||
|
||||
// Initialize the SQRLUpdater.
|
||||
NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)];
|
||||
NSURLRequest* urlRequest = [NSURLRequest requestWithURL:url];
|
||||
|
||||
@try {
|
||||
g_updater = [[SQRLUpdater alloc] initWithUpdateRequest:urlRequest];
|
||||
} @catch (NSException* error) {
|
||||
delegate->OnError(base::SysNSStringToUTF8(error.reason));
|
||||
return;
|
||||
}
|
||||
|
||||
[[g_updater rac_valuesForKeyPath:@"state" observer:g_updater]
|
||||
subscribeNext:^(NSNumber *stateNumber) {
|
||||
int state = [stateNumber integerValue];
|
||||
|
|
Loading…
Reference in a new issue