Skip to content

Commit

Permalink
fix: improve error handling
Browse files Browse the repository at this point in the history
Fail the browser if Sauce Connect fails.
  • Loading branch information
vojtajina committed Dec 1, 2013
1 parent 32910fd commit 773a3fb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ var SauceConnect = function(emitter, logger) {

alreadyRunningDefered = q.defer();
launchSauceConnect(options, function(err, p) {
if (err) {
return alreadyRunningDefered.reject(err);
}

alreadyRunningProces = p;
alreadyRunningDefered.resolve();
});
Expand All @@ -49,6 +53,7 @@ var SauceConnect = function(emitter, logger) {
if (alreadyRunningProces) {
log.info('Shutting down Sauce Connect');
alreadyRunningProces.close(done);
alreadyRunningProces = null;
} else {
done();
}
Expand Down Expand Up @@ -143,6 +148,9 @@ var SauceLabsBrowser = function(id, args, sauceConnect, /* config.sauceLabs */ c
if (startConnect) {
sauceConnect.start(username, accessKey, tunnelIdentifier).then(function() {
start(url);
}, function(err) {
log.error('Can not start %s\n Failed to start Sauce Connect:\n %s', browserName, err.message);
emitter.emit('browser_process_failure', self);
});
} else {
start(url);
Expand All @@ -151,7 +159,7 @@ var SauceLabsBrowser = function(id, args, sauceConnect, /* config.sauceLabs */ c

this.kill = function(done) {
if (!driver) {
return;
return process.nextTick(done);
}

clearTimeout(pendingHeartBeat);
Expand Down

0 comments on commit 773a3fb

Please sign in to comment.