浏览代码

Catch the JSON undefined error

Gaël Métais 10 年之前
父节点
当前提交
6e8c73dfe0
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      app/lib/phantomasWrapper.js

+ 4 - 4
app/lib/phantomasWrapper.js

@@ -81,16 +81,16 @@ var PhantomasWrapper = function() {
                     err = 1001;
                     err = 1001;
                 }
                 }
 
 
-                // Don't cancel test if it is a timeout
-                if (err === 252) {
+                // 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.');
                     console.log('Timeout after ' + options.timeout + ' seconds. But it\'s not a problem, the test is valid.');
                     err = null;
                     err = null;
                 }
                 }
 
 
                 // Strange bug: no err but no json either
                 // Strange bug: no err but no json either
-                if (!json && json == 'undefined') {
+                /*if (!json && json == 'undefined') {
                     err = 1002;
                     err = 1002;
-                }
+                }*/
 
 
                 if (err) {
                 if (err) {
                     console.log('Attempt failed for test id ' + task.testId + '. Error code ' + err);
                     console.log('Attempt failed for test id ' + task.testId + '. Error code ' + err);