This repository was archived by the owner on Jan 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-17
lines changed Expand file tree Collapse file tree 3 files changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,6 @@ export class BrowserBackend implements Backend {
105
105
} ,
106
106
} ;
107
107
108
- console . log ( event ) ;
109
-
110
108
return event ;
111
109
}
112
110
@@ -127,8 +125,6 @@ export class BrowserBackend implements Backend {
127
125
} ;
128
126
}
129
127
130
- console . log ( event ) ;
131
-
132
128
return event ;
133
129
}
134
130
Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ export class GlobalHandlers implements Integration {
18
18
public constructor (
19
19
private options : {
20
20
onerror : boolean ;
21
- onunhandledpromiserejection : boolean ;
21
+ onunhandledrejection : boolean ;
22
22
} =
10000
span> {
23
23
onerror : true ,
24
- onunhandledpromiserejection : true ,
24
+ onunhandledrejection : true ,
25
25
} ,
26
26
) { }
27
27
/**
@@ -51,24 +51,22 @@ export class GlobalHandlers implements Integration {
51
51
installGlobalHandler ( ) ;
52
52
}
53
53
54
- if ( this . options . onunhandledpromiserejection ) {
55
- logger . log ( 'Global Handler attached: onunhandledpromiserejection ' ) ;
54
+ if ( this . options . onunhandledrejection ) {
55
+ logger . log ( 'Global Handler attached: onunhandledrejection ' ) ;
56
56
installGlobalUnhandledRejectionHandler ( ) ;
57
57
}
58
58
}
59
59
60
60
/** TODO */
61
61
private eventFromGlobalHandler ( stacktrace : TraceKitStackTrace ) : SentryEvent {
62
62
const event = eventFromStacktrace ( stacktrace ) ;
63
- console . log ( event ) ;
64
- // TODO: Make a distinction between 'onunhandledrejection' and 'onerror'
65
63
return {
66
64
...event ,
67
65
exception : {
68
66
...event . exception ,
69
67
mechanism : {
70
68
handled : false ,
71
- type : 'onerror' ,
69
+ type : stacktrace . mode === 'onerror' ? 'onerror' : 'onunhandledrejection ',
72
70
} ,
73
71
} ,
74
72
} ;
Original file line number Diff line number Diff line change @@ -57,15 +57,18 @@ export function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[]
57
57
return [ ] ;
58
58
}
59
59
60
- return stack
61
- . filter (
62
- // TODO: This could be smarter
63
- frame => ! frame . func . includes ( 'captureMessage' ) && ! frame . func . includes ( 'captureException' ) ,
64
- )
60
+ let localStack = stack ;
61
+
62
+ // TODO: This could be smarter
63
+ if ( localStack [ 0 ] . func . includes ( 'captureMessage' ) || localStack [ 0 ] . func . includes ( 'captureException' ) ) {
64
+ localStack = localStack . slice ( 1 ) ;
65
+ }
66
+
67
+ return localStack
65
68
. map (
66
69
( frame : TraceKitStackFrame ) : StackFrame => ( {
67
70
colno : frame . column ,
68
- filename : frame . url || stack [ 0 ] . url ,
71
+ filename : frame . url || localStack [ 0 ] . url ,
69
72
function : frame . func || '?' ,
70
73
in_app : true ,
71
74
lineno : frame . line ,
You can’t perform that action at this time.
0 commit comments