Skip to content

Commit 2e387fc

Browse files
committed
feat(scope): Only set lastEventId for error events
1 parent 9078e45 commit 2e387fc

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/core/src/baseclient.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,8 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
650650

651651
this.emit('preprocessEvent', event, hint);
652652

653-
const eventId = event.event_id || hint.event_id;
654-
if (eventId) {
655-
isolationScope.setLastEventId(eventId);
653+
if (!event.type) {
654+
isolationScope.setLastEventId(event.event_id || hint.event_id);
656655
}
657656

658657
return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {

packages/core/src/exports.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ export function setUser(user: User | null): void {
123123
/**
124124
* The last error event id of the isolation scope.
125125
*
126-
* Warning: This function really returns the last recorded error event id on the current
127-
* isolation scope. If you call this function after handling a certain error and another error
128-
* is captured in between, the last one is returned instead of the one you might expect.
129-
* Also, ids of events that were never sent to Sentry (for example because
126+
* Warning: This function really returns the last recorded error event id on the current
127+
* isolation scope. If you call this function after handling a certain error and another error
128+
* is captured in between, the last one is returned instead of the one you might expect.
129+
* Also, ids of events that were never sent to Sentry (for example because
130130
* they were dropped in `beforeSend`) could be returned.
131131
*
132132
* @returns The last event id of the isolation scope.

0 commit comments

Comments
 (0)