Skip to content

Commit f3a52d7

Browse files
committed
fixup! fix(core): add a PromiseBuffer for incoming events on the client
1 parent 9a8c083 commit f3a52d7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/core/src/client.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type { EventDropReason, Outcome } from './types-hoist/clientreport';
1818
import type { DataCategory } from './types-hoist/datacategory';
1919
import type { DsnComponents } from './types-hoist/dsn';
2020
import 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';
2222
import type { EventProcessor } from './types-hoist/eventprocessor';
2323
import type { FeedbackEvent } from './types-hoist/feedback';
2424
import 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

Comments
 (0)