Skip to content

Commit

Permalink
Empty stack in onError signal handler throws SyntaxError
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Jun 3, 2016
1 parent a733829 commit fcf5643
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ phantom.__defineErrorSignalHandler__ = function(obj, page, handlers) {

if (typeof f === 'function') {
var connector = function (message, lineNumber, source, stack) {
var revisedStack = JSON.parse(stack).map(function (item) {
return { file: item.url, line: item.lineNumber, function: item.functionName };
});
var revisedStack = [];
if (stack) {
revisedStack = JSON.parse(stack).map(function (item) {
return { file: item.url, line: item.lineNumber, function: item.functionName };
});
}
if (revisedStack.length == 0)
revisedStack = [{ file: source, line: lineNumber }];

Expand Down

0 comments on commit fcf5643

Please sign in to comment.