Merge pull request #1294 from atom/catch-sign

Catches and reports exception thrown from Squirrel
This commit is contained in:
Cheng Zhao 2015-03-25 20:14:07 +08:00
commit a0770580e9
2 changed files with 12 additions and 6 deletions

View file

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

View file

@ -7,7 +7,7 @@ import os
from lib.util import safe_mkdir, rm_rf, extract_zip, tempdir, download from lib.util import safe_mkdir, rm_rf, extract_zip, tempdir, download
VERSION = 'v0.3.0' VERSION = 'v0.4.0'
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
FRAMEWORKS_URL = 'http://github.com/atom/atom-shell-frameworks/releases' \ FRAMEWORKS_URL = 'http://github.com/atom/atom-shell-frameworks/releases' \
'/download/' + VERSION '/download/' + VERSION