@@ -18,7 +18,7 @@ import type { EventDropReason, Outcome } from './types-hoist/clientreport';
1818import type { DataCategory } from './types-hoist/datacategory' ;
1919import type { DsnComponents } from './types-hoist/dsn' ;
2020import type { DynamicSamplingContext , Envelope } from './types-hoist/envelope' ;
21- import type { ErrorEvent , Event , EventHint , TransactionEvent } from './types-hoist/event' ;
21+ import type { ErrorEvent , Event , EventHint , EventType , TransactionEvent } from './types-hoist/event' ;
2222import type { EventProcessor } from './types-hoist/eventprocessor' ;
2323import type { FeedbackEvent } from './types-hoist/feedback' ;
2424import type { Integration } from './types-hoist/integration' ;
@@ -335,7 +335,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
335335 const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
336336 const capturedSpanScope : Scope | undefined = sdkProcessingMetadata . capturedSpanScope ;
337337 const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
338- const dataCategory = event . type === 'replay_event' ? 'replay' : ( event . type ?? 'unknown' ) ;
338+ const dataCategory = getDataCategoryByType ( event . type ) ;
339339
340340 this . _process (
341341 ( ) => this . _captureEvent ( event , hintWithEventId , capturedSpanScope || currentScope , capturedSpanIsolationScope ) ,
@@ -1241,7 +1241,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
12411241 ) ;
12421242 }
12431243
1244- const dataCategory = ( eventType === 'replay_event' ? 'replay' : eventType ) satisfies DataCategory ;
1244+ const dataCategory = getDataCategoryByType ( event . type ) ;
12451245
12461246 return this . _prepareEvent ( event , hint , currentScope , isolationScope )
12471247 . then ( prepared => {
@@ -1403,6 +1403,10 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
14031403 ) : PromiseLike < Event > ;
14041404}
14051405
1406+ function getDataCategoryByType ( type : EventType | 'replay_event' | undefined ) : DataCategory {
1407+ return type === 'replay_event' ? 'replay' : type || 'error' ;
1408+ }
1409+
14061410/**
14071411 * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
14081412 */
0 commit comments