check for error before you do anything else

This commit is contained in:
soulgalore 2014-08-12 13:37:49 +02:00
parent 981836513a
commit b2e3f03baa
1 changed files with 7 additions and 7 deletions

View File

@ -79,6 +79,13 @@ function analyzeUrl(args, asyncDoneCallback) {
wpt.runTest(url, wptOptions, function(err, data) {
if (err) {
log.log('error', "WebPageTest couldn't fetch info for url " + url + '(' +
JSON.stringify(err) + ')');
asyncDoneCallback(undefined, err);
return;
}
var id = data.response.data.testId;
/*
@ -105,13 +112,6 @@ function analyzeUrl(args, asyncDoneCallback) {
*/
// TODO check for err
if (err) {
log.log('error', "WebPageTest couldn't fetch info for url " + url + '(' +
JSON.stringify(err) + ')');
asyncDoneCallback(undefined, err);
return;
}
var jsonPath = path.join(config.run.absResultDir, config.dataDir,
'webpagetest',
util.getUrlHash(url) + '-webpagetest.json');