diff --git a/lib/engines/phantom.js b/lib/engines/phantom.js index d4ffc1c..a29c452 100644 --- a/lib/engines/phantom.js +++ b/lib/engines/phantom.js @@ -41,8 +41,12 @@ PhantomEngine.prototype.init = function(appUrl, initCallback, errorCallback, bef _this.phantom.page.set('onCallback', _.bind(_this.onPageReady, _this)); - _this.phantom.page.set('onError', function(msg) { - errorCallback("Phantom encountered an error: " + msg); + _this.phantom.page.set('onError', function(msg, trace) { + var error = msg; + if(trace.length) { + error += "\n" + JSON.stringify(trace, null, 2); + } + errorCallback("Phantom encountered an error: " + error); }); // FIXME: Uncomment after resolving issue in phantomjs-node (https://github.com/sgentle/phantomjs-node/issues/203)