1
1
// tslint:disable
2
2
3
- import { getGlobalObject , isError , isErrorEvent } from '@sentry/utils' ;
3
+ import { getGlobalObject , isError , isErrorEvent , normalize } from '@sentry/utils' ;
4
4
5
5
/**
6
6
* @hidden
@@ -38,7 +38,6 @@ interface ComputeStackTrace {
38
38
* @param {(string|number)= } depth
39
39
*/
40
40
( ex : Error , depth ?: string | number ) : StackTrace ;
41
- _computeStackTraceFromStackProp ( ex : any ) : StackTrace ;
42
41
}
43
42
44
43
/**
@@ -275,6 +274,9 @@ TraceKit._report = (function reportModuleWrapper() {
275
274
var err = ( e && ( e . detail ? e . detail . reason : e . reason ) ) || e ;
276
275
var stack = TraceKit . _computeStackTrace ( err ) ;
277
276
stack . mechanism = 'onunhandledrejection' ;
277
+ if ( ! stack . message ) {
278
+ stack . message = JSON . stringify ( normalize ( err ) )
279
+ }
278
280
_notifyHandlers ( stack , true , err ) ;
279
281
}
280
282
@@ -479,7 +481,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
479
481
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
480
482
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
481
483
// We need this specific case for now because we want no other regex to match.
482
- gecko = / ^ \s * ( .* ?) (?: \( ( .* ?) \) ) ? (?: ^ | @ ) ( (?: f i l e | h t t p s ? | b l o b | c h r o m e | w e b p a c k | r e s o u r c e | m o z - e x t e n s i o n ) .* ?: \/ .* ?| \[ n a t i v e c o d e \] | [ ^ @ ] * (?: b u n d l e | \d + \. j s ) ) (?: : ( \d + ) ) ? (?: : ( \d + ) ) ? \s * $ / i,
484
+ gecko = / ^ \s * ( .* ?) (?: \( ( .* ?) \) ) ? (?: ^ | @ ) ? ( (?: f i l e | h t t p s ? | b l o b | c h r o m e | w e b p a c k | r e s o u r c e | m o z - e x t e n s i o n ) .* ?: \/ .* ?| \[ n a t i v e c o d e \] | [ ^ @ ] * (?: b u n d l e | \d + \. j s ) ) (?: : ( \d + ) ) ? (?: : ( \d + ) ) ? \s * $ / i,
483
485
winjs = / ^ \s * a t (?: ( (?: \[ o b j e c t o b j e c t \] ) ? .+ ) ) ? \( ? ( (?: f i l e | m s - a p p x | h t t p s ? | w e b p a c k | b l o b ) : .* ?) : ( \d + ) (?: : ( \d + ) ) ? \) ? \s * $ / i,
484
486
// Used to additionally parse URL/line/column from eval frames
485
487
isEval ,
@@ -494,6 +496,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
494
496
495
497
for ( var i = 0 , j = lines . length ; i < j ; ++ i ) {
496
498
if ( ( parts = chrome . exec ( lines [ i ] ) ) ) {
499
+ var isNative = parts [ 2 ] && parts [ 2 ] . indexOf ( 'native' ) === 0 ; // start of line
497
500
isEval = parts [ 2 ] && parts [ 2 ] . indexOf ( 'eval' ) === 0 ; // start of line
498
501
if ( isEval && ( submatch = chromeEval . exec ( parts [ 2 ] ) ) ) {
499
502
// throw out eval line/column and use top-most line/column number
@@ -504,7 +507,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
504
507
element = {
505
508
url : parts [ 2 ] ,
506
509
func : parts [ 1 ] || UNKNOWN_FUNCTION ,
507
- args : [ ] ,
510
+ args : isNative ? [ parts [ 2 ] ] : [ ] ,
508
511
line : parts [ 3 ] ? + parts [ 3 ] : null ,
509
512
column : parts [ 4 ] ? + parts [ 4 ] : null ,
510
513
} ;
@@ -520,6 +523,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
520
523
isEval = parts [ 3 ] && parts [ 3 ] . indexOf ( ' > eval' ) > - 1 ;
521
524
if ( isEval && ( submatch = geckoEval . exec ( parts [ 3 ] ) ) ) {
522
525
// throw out eval line/column and use top-most line number
526
+ parts [ 1 ] = parts [ 1 ] || `eval` ;
523
527
parts [ 3 ] = submatch [ 1 ] ;
524
528
parts [ 4 ] = submatch [ 2 ] ;
525
529
parts [ 5 ] = '' ; // no column when eval
0 commit comments