@@ -64,7 +64,7 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
64
64
const errorEvent = exception as ErrorEvent ;
65
65
exception = errorEvent . error ; // tslint:disable-line:no-parameter-reassignment
66
66
event = eventFromStacktrace ( computeStackTrace ( exception as Error ) ) ;
67
- return SyncPromise . resolve ( this . buildEvent ( event ) ) ;
67
+ return SyncPromise . resolve ( this . buildEvent ( event , hint ) ) ;
68
68
} else if ( isDOMError ( exception as DOMError ) || isDOMException ( exception as DOMException ) ) {
69
69
// If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
70
70
// then we just extract the name and message, as they don't provide anything else
@@ -76,20 +76,20 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
76
76
77
77
return this . eventFromMessage ( message , Severity . Error , hint ) . then ( messageEvent => {
78
78
addExceptionTypeValue ( messageEvent , message ) ;
79
- return SyncPromise . resolve ( this . buildEvent ( messageEvent ) ) ;
79
+ return SyncPromise . resolve ( this . buildEvent ( messageEvent , hint ) ) ;
80
80
} ) ;
81
81
} else if ( isError ( exception as Error ) ) {
82
82
// we have a real Error object, do nothing
83
83
event = eventFromStacktrace ( computeStackTrace ( exception as Error ) ) ;
84
- return SyncPromise . resolve ( this . buildEvent ( event ) ) ;
84
+ return SyncPromise . resolve ( this . buildEvent ( event , hint ) ) ;
85
85
} else if ( isPlainObject ( exception as { } ) && hint && hint . syntheticException ) {
86
86
// If it is plain Object, serialize it manually and extract options
87
87
// This will allow us to group events based on top-level keys
88
88
// which is much better than creating new group when any key/value change
89
89
const objectException = exception as { } ;
90
90
event = eventFromPlainObject ( objectException , hint . syntheticException ) ;
91
91
addExceptionTypeValue ( event , 'Custom Object' ) ;
92
- return SyncPromise . resolve ( this . buildEvent ( event ) ) ;
92
+ return SyncPromise . resolve ( this . buildEvent ( event , hint , true ) ) ;
93
93
}
94
94
95
95
// If none of previous checks were valid, then it means that
@@ -101,21 +101,22 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
101
101
const stringException = exception as string ;
102
102
return this . eventFromMessage ( stringException , undefined , hint ) . then ( messageEvent => {
103
103
addExceptionTypeValue ( messageEvent , `${ stringException } ` ) ;
104
- return SyncPromise . resolve ( this . buildEvent ( messageEvent ) ) ;
104
+ return SyncPromise . resolve ( this . buildEvent ( messageEvent , hint , true ) ) ;
105
105
} ) ;
106
106
}
107
107
108
108
/**
109
109
* This is an internal helper function that creates an event.
110
110
*/
111
- private buildEvent ( event : Event , hint ?: EventHint ) : Event {
111
+ private buildEvent ( event : Event , hint ?: EventHint , isSynthetic ?: boolean ) : Event {
112
112
return {
113
113
...event ,
114
114
event_id : hint && hint . event_id ,
115
115
exception : {
116
116
...event . exception ,
117
117
mechanism : {
118
118
handled : true ,
119
+ synthetic : isSynthetic ,
119
120
type : 'generic' ,
120
121
} ,
121
122
} ,
0 commit comments