From 58b9a4455433bc3d156cceda291754a97142af00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Fri, 5 Sep 2014 11:18:55 +0200 Subject: [PATCH] Catch the JSON undefined error --- app/lib/phantomasWrapper.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/lib/phantomasWrapper.js b/app/lib/phantomasWrapper.js index 32b60ca..80a3da1 100644 --- a/app/lib/phantomasWrapper.js +++ b/app/lib/phantomasWrapper.js @@ -81,17 +81,18 @@ var PhantomasWrapper = function() { err = 1001; } + if (!json || !json.metrics) { + console.log('IIIIIIIIIIK'); + console.log(err); + console.log(json); + } + // Don't cancel test if it is a timeout and we've got some results if (err === 252 && json) { console.log('Timeout after ' + options.timeout + ' seconds. But it\'s not a problem, the test is valid.'); err = null; } - // Strange bug: no err but no json either - /*if (!json && json == 'undefined') { - err = 1002; - }*/ - if (err) { console.log('Attempt failed for test id ' + task.testId + '. Error code ' + err); }