Skip to content

Commit

Permalink
Log "page.onError".
Browse files Browse the repository at this point in the history
  • Loading branch information
detro committed Jul 24, 2013
1 parent 7a59e5d commit e3c255e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ ghostdriver.Session = function(desiredCapabilities) {
},

_setOneShotCallbackDecorator = function(callbackName, handlerFunc) {
if (callbackName === "onError") {
this["onError"] = handlerFunc;
} else {
this[callbackName + _const.ONE_SHOT_POSTFIX] = handlerFunc;
}
this[callbackName + _const.ONE_SHOT_POSTFIX] = handlerFunc;
},

_resetOneShotCallbacksDecorator = function() {
Expand All @@ -256,7 +252,6 @@ ghostdriver.Session = function(desiredCapabilities) {
this["onLoadStarted" + _const.ONE_SHOT_POSTFIX] = null;
this["onLoadFinished" + _const.ONE_SHOT_POSTFIX] = null;
this["onUrlChanged" + _const.ONE_SHOT_POSTFIX] = null;
this["onError"] = phantom.defaultErrorHandler;
},

// Add any new page to the "_windows" container of this session
Expand Down Expand Up @@ -308,6 +303,11 @@ ghostdriver.Session = function(desiredCapabilities) {
}
// 7. Applying Page custom headers received via capabilities
page.customHeaders = _pageCustomHeaders;
// 8. Log Page internal errors
page["onError"] = function(errorMsg, errorStack) {
_log.error("Page at '"+page.url+"'", "Console Error (msg): " + errorMsg);
_log.error("Page at '"+page.url+"'", "Console Error (stack): " + JSON.stringify(errorStack, null, " "));
};

page.onConsoleMessage = function(msg) { _log.debug("page.onConsoleMessage", msg); };

Expand Down

0 comments on commit e3c255e

Please sign in to comment.