From: Wolfram Schneider Date: Tue, 4 Feb 2014 16:29:04 +0000 (+0000) Subject: display HTTP errors and give up X-Git-Tag: 1.0.0~1530 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=9cd077f0d22e39276824a2577f9b138b1b71c337;p=mkws-moved-to-github.git display HTTP errors and give up page.open(url, function (status) checks only for network errors, and will return 'success' for HTTP 404. We must check onResourceError too --- diff --git a/test/phantom/evaluate.js b/test/phantom/evaluate.js index ccf01e4..8cc4c3e 100644 --- a/test/phantom/evaluate.js +++ b/test/phantom/evaluate.js @@ -76,12 +76,18 @@ page.onAlert = function (msg) { console.log("Alert: " + msg); }; +// display HTTP errors +page.onResourceError = function (resourceError) { + // console.log('phantomjs error code: ' + resourceError.errorCode); + console.log(resourceError.errorString); + phantom.exit(3); +}; page.open(url, function (status) { if (debug >= 1) console.log("fetch " + url + " with status: " + status); if (status != 'success') { - console.log("Failed to fetch page, give up"); + console.log("Failed to fetch page, give up. Network error?"); phantom.exit(1); }