Skip to content

Commit

Permalink
Test: Try again to fix PhantomJS error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed May 30, 2017
1 parent d2d1cc4 commit 7d94e87
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions test/phantom.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (system.args.length !== 2) {

const page = require('webpage').create();

phantom.onError = function(err, trace) {
page.onError = phantom.onError = function(err, trace) {
console.log('PhantomJS error:', err);
if (trace && trace.length > 0) {
trace.forEach(function(t) {
Expand All @@ -28,18 +28,12 @@ phantom.onError = function(err, trace) {
}
phantom.exit(1);
};
page.onError = function(err) {
console.log('PhantomJS error:', err.errorString);
phantom.exit(1);
};
page.onResourceError = page.onResourceTimeout = function(err) {
if (err.url.startsWith('http://placebeard.it/')) {
return;
}

console.log('PhantomJS cannot load resource:', err.url, '-', err.errorString);
};

page.onConsoleMessage = function(msg) {
console.log('PhantomJS:', msg);
};
Expand Down

0 comments on commit 7d94e87

Please sign in to comment.