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
|
// static
|
||||||
void AutoUpdater::SetFeedURL(const std::string& feed) {
|
void AutoUpdater::SetFeedURL(const std::string& feed) {
|
||||||
if (g_updater == nil) {
|
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();
|
AutoUpdaterDelegate* delegate = GetDelegate();
|
||||||
if (!delegate)
|
if (!delegate)
|
||||||
return;
|
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]
|
[[g_updater rac_valuesForKeyPath:@"state" observer:g_updater]
|
||||||
subscribeNext:^(NSNumber *stateNumber) {
|
subscribeNext:^(NSNumber *stateNumber) {
|
||||||
int state = [stateNumber integerValue];
|
int state = [stateNumber integerValue];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue