@@ -21,15 +21,15 @@ export function handleGlobalEventListener(replay: ReplayContainer): (event: Even
2121
2222 // Unless `captureExceptions` is enabled, we want to ignore errors coming from rrweb
2323 // As there can be a bunch of stuff going wrong in internals there, that we don't want to bubble up to users
24- if ( isRrwebError ( event ) && ! replay . getOptions ( ) . _experiments ? .captureExceptions ) {
24+ if ( isRrwebError ( event ) && ! replay . getOptions ( ) . _experiments . captureExceptions ) {
2525 __DEBUG_BUILD__ && logger . log ( '[Replay] Ignoring error from rrweb internals' , event ) ;
2626 return null ;
2727 }
2828
2929 // Only tag transactions with replayId if not waiting for an error
3030 // @ts -ignore private
3131 if ( ! event . type || replay . recordingMode === 'session' ) {
32- event . tags = { ...event . tags , replayId : replay . session ?. id } ;
32+ event . tags = { ...event . tags , replayId : replay . getSessionId ( ) } ;
3333 }
3434
3535 // Collect traceIds in _context regardless of `recordingMode` - if it's true,
@@ -44,12 +44,10 @@ export function handleGlobalEventListener(replay: ReplayContainer): (event: Even
4444 replay . getContext ( ) . errorIds . add ( event . event_id as string ) ;
4545 }
4646
47- const exc = event . exception ?. values ?. [ 0 ] ;
48- if ( __DEBUG_BUILD__ && replay . getOptions ( ) . _experiments ?. traceInternals ) {
47+ if ( __DEBUG_BUILD__ && replay . getOptions ( ) . _experiments . traceInternals ) {
48+ const exc = getEventExceptionValues ( event ) ;
4949 addInternalBreadcrumb ( {
50- message : `Tagging event (${ event . event_id } ) - ${ event . message } - ${ exc ?. type || 'Unknown' } : ${
51- exc ?. value || 'n/a'
52- } `,
50+ message : `Tagging event (${ event . event_id } ) - ${ event . message } - ${ exc . type } : ${ exc . value } ` ,
5351 } ) ;
5452 }
5553
@@ -89,3 +87,11 @@ function addInternalBreadcrumb(arg: Parameters<typeof addBreadcrumb>[0]): void {
8987 ...rest ,
9088 } ) ;
9189}
90+
91+ function getEventExceptionValues ( event : Event ) : { type : string ; value : string } {
92+ return {
93+ type : 'Unknown' ,
94+ value : 'n/a' ,
95+ ...( event . exception && event . exception . values && event . exception . values [ 0 ] ) ,
96+ } ;
97+ }
0 commit comments