Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Improve error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimBarham committed Oct 16, 2015
1 parent 9d87411 commit d57e7ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/simulate
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

// Copyright (c) Microsoft Corporation. All rights reserved.

var chalk = require('chalk');
var simulateServer = require('taco-simulate-server');

var args;
try {
args = processArgs(process.argv);
require('./../src/simulate')({platform: args.platform, target: args.target}).catch(function (e) {
console.log(chalk.red.bold(e.toString()));
simulateServer.log.error(e);
});
} catch (e) {
console.log(chalk.red.bold(e.toString()));
simulateServer.log.error(e);
}

function processArgs(args) {
Expand Down
4 changes: 4 additions & 0 deletions src/simulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ module.exports = function (opts) {
return cordovaServe.launchBrowser({target: target, url: urls.appUrl});
}).then(function () {
return cordovaServe.launchBrowser({target: target, url: simHostUrl});
}).catch(function (error) {
// Ensure server is closed, then rethrow so it can be handled by downstream consumers.
simulateServer.server && simulateServer.server.close();
throw error;
});
};

0 comments on commit d57e7ff

Please sign in to comment.