Skip to content

Commit 7381a49

Browse files
committed
fixup! fix(core): add a PromiseBuffer for incoming events on the client
1 parent 2ee14b4 commit 7381a49

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';
@@ -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

Comments
 (0)