File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -1337,7 +1337,7 @@ Raven.prototype = {
1337
1337
var frames = [ ] ;
1338
1338
if ( stackInfo . stack && stackInfo . stack . length ) {
1339
1339
each ( stackInfo . stack , function ( i , stack ) {
1340
- var frame = self . _normalizeFrame ( stack ) ;
1340
+ var frame = self . _normalizeFrame ( stack , stackInfo . url ) ;
1341
1341
if ( frame ) {
1342
1342
frames . push ( frame ) ;
1343
1343
}
@@ -1354,8 +1354,21 @@ Raven.prototype = {
1354
1354
return frames ;
1355
1355
} ,
1356
1356
1357
- _normalizeFrame : function ( frame ) {
1358
- if ( ! frame . url ) return ;
1357
+ _normalizeFrame : function ( frame , stackInfoUrl ) {
1358
+ if ( ! frame . url ) {
1359
+ // Case when we don't have any information about the error
1360
+ // E.g. throwing a string or raw object in Firefox
1361
+ // Generating synthetic error doesn't add any value here
1362
+ //
1363
+ // We should probably somehow let user know that he should fix his code
1364
+ return {
1365
+ filename : stackInfoUrl , // fallback to whole stacks url from onerror handler
1366
+ lineno : frame . line ,
1367
+ colno : frame . column ,
1368
+ function : frame . func || '?' , // if we dont have a file url, we most likely won't have a function name either
1369
+ in_app : true // this will always come from the user's code
1370
+ } ;
1371
+ }
1359
1372
1360
1373
// normalize the frames data
1361
1374
var normalized = {
You can’t perform that action at this time.
0 commit comments