Skip to content

Commit

Permalink
add more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
localnerve committed Jan 25, 2017
1 parent e409b9e commit bc864f4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/phantom/modules/selectorDetect.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ var start = new Date().getTime();
var page = require("webpage").create();
var fs = require("fs");
var globals = require("./globals");
// @@@
var system = require("system");
// @@@

/**
* waitFor
Expand Down Expand Up @@ -61,6 +64,25 @@ function snapshot(options, detector, filter) {
"Accept-Encoding": "identity"
};

// @@@
page.onError = function (msg, trace) {
system.stderr.writeLine('onError');
var msgStack = [' Error: ' + msg];
if (trace) {
msgStack.push(' Trace:');
trace.forEach(function (t) {
msgStack.push(' -> '+ t.file + ': ' + t.line);
});
}
system.stderr.writeLine(msgStack.join('\n'));
}
page.onResourceError = function (resourceError) {
system.stderr.writeLine("= onResourceError()");
system.stderr.writeLine(" - unable to load url: '" +resourceError.url+"'");
system.stderr.writeLine(" - error (" + resourceError.errorCode + "): " + resourceError.errorString);
}
// @@@

// create the snapshot
page.open(options.url, function (status) {
if (status !== "success") {
Expand Down

0 comments on commit bc864f4

Please sign in to comment.