diff --git a/src/raven.js b/src/raven.js index 78991f21e5cc..d3876255d270 100644 --- a/src/raven.js +++ b/src/raven.js @@ -1369,7 +1369,7 @@ Raven.prototype = { var frames = []; if (stackInfo.stack && stackInfo.stack.length) { each(stackInfo.stack, function(i, stack) { - var frame = self._normalizeFrame(stack); + var frame = self._normalizeFrame(stack, stackInfo.url); if (frame) { frames.push(frame); } @@ -1386,8 +1386,21 @@ Raven.prototype = { return frames; }, - _normalizeFrame: function(frame) { - if (!frame.url) return; + _normalizeFrame: function(frame, stackInfoUrl) { + if (!frame.url) { + // Case when we don't have any information about the error + // E.g. throwing a string or raw object in Firefox + // Generating synthetic error doesn't add any value here + // + // We should probably somehow let user know that he should fix his code + return { + filename: stackInfoUrl, // fallback to whole stacks url from onerror handler + lineno: frame.line, + colno: frame.column, + function: frame.func || '?', // if we dont have a file url, we most likely won't have a function name either + in_app: true // this will always come from the user's code + }; + } // normalize the frames data var normalized = {