@@ -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' ;
@@ -342,7 +342,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
342342 const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
343343 const capturedSpanScope : Scope | undefined = sdkProcessingMetadata . capturedSpanScope ;
344344 const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
345- const dataCategory = event . type === 'replay_event' ? 'replay' : ( event . type ?? 'unknown' ) ;
345+ const dataCategory = getDataCategoryByType ( event . type ) ;
346346
347347 this . _process (
348348 ( ) => this . _captureEvent ( event , hintWithEventId , capturedSpanScope || currentScope , capturedSpanIsolationScope ) ,
@@ -1264,7 +1264,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
12641264 ) ;
12651265 }
12661266
1267- const dataCategory = ( eventType === 'replay_event' ? 'replay' : eventType ) satisfies DataCategory ;
1267+ const dataCategory = getDataCategoryByType ( event . type ) ;
12681268
12691269 return this . _prepareEvent ( event , hint , currentScope , isolationScope )
12701270 . then ( prepared => {
@@ -1426,6 +1426,10 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
14261426 ) : PromiseLike < Event > ;
14271427}
14281428
1429+ function getDataCategoryByType ( type : EventType | 'replay_event' | undefined ) : DataCategory {
1430+ return type === 'replay_event' ? 'replay' : type || 'error' ;
1431+ }
1432+
14291433/**
14301434 * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
14311435 */
0 commit comments