@@ -17,6 +17,7 @@ import type {
17
17
Integration ,
18
18
Outcome ,
19
19
ParameterizedString ,
20
+ Scope ,
20
21
SdkMetadata ,
21
22
Session ,
22
23
SessionAggregates ,
@@ -52,7 +53,6 @@ import { createEventEnvelope, createSessionEnvelope } from './envelope';
52
53
import type { IntegrationIndex } from './integration' ;
53
54
import { afterSetupIntegrations } from './integration' ;
54
55
import { setupIntegration , setupIntegrations } from './integration' ;
55
- import type { Scope } from './scope' ;
56
56
import { updateSession } from './session' ;
57
57
import { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext' ;
58
58
import { parseSampleRate } from './utils/parseSampleRate' ;
@@ -151,7 +151,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
151
151
* @inheritDoc
152
152
*/
153
153
// eslint-disable-next-line @typescript-eslint/no-explicit-any
154
- public captureException ( exception : any , hint ?: EventHint , scope ?: Scope ) : string | undefined {
154
+ public captureException ( exception : any , hint ?: EventHint , currentScope ?: Scope ) : string | undefined {
155
155
// ensure we haven't captured this very object before
156
156
if ( checkOrSetAlreadyCaught ( exception ) ) {
157
157
DEBUG_BUILD && logger . log ( ALREADY_SEEN_ERROR ) ;
@@ -162,7 +162,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
162
162
163
163
this . _process (
164
164
this . eventFromException ( exception , hint )
165
- . then ( event => this . _captureEvent ( event , hint , scope ) )
165
+ . then ( event => this . _captureEvent ( event , hint , currentScope ) )
166
166
. then ( result => {
167
167
eventId = result ;
168
168
} ) ,
@@ -178,7 +178,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
178
178
message : ParameterizedString ,
179
179
level ?: SeverityLevel ,
180
180
hint ?: EventHint ,
181
- scope ?: Scope ,
181
+ currentScope ?: Scope ,
182
182
) : string | undefined {
183
183
let eventId : string | undefined = hint && hint . event_id ;
184
184
@@ -190,7 +190,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
190
190
191
191
this . _process (
192
192
promisedEvent
193
- . then ( event => this . _captureEvent ( event , hint , scope ) )
193
+ . then ( event => this . _captureEvent ( event , hint , currentScope ) )
194
194
. then ( result => {
195
195
eventId = result ;
196
196
} ) ,
@@ -202,7 +202,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
202
202
/**
203
203
* @inheritDoc
204
204
*/
205
- public captureEvent ( event : Event , hint ?: EventHint , scope ?: Scope ) : string | undefined {
205
+ public captureEvent ( event : Event , hint ?: EventHint , currentScope ?: Scope ) : string | undefined {
206
206
// ensure we haven't captured this very object before
207
207
if ( hint && hint . originalException && checkOrSetAlreadyCaught ( hint . originalException ) ) {
208
208
DEBUG_BUILD && logger . log ( ALREADY_SEEN_ERROR ) ;
@@ -215,7 +215,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
215
215
const capturedSpanScope : Scope | undefined = sdkProcessingMetadata . capturedSpanScope ;
216
216
217
217
this . _process (
218
- this . _captureEvent ( event , hint , capturedSpanScope || scope ) . then ( result => {
218
+ this . _captureEvent ( event , hint , capturedSpanScope || currentScope ) . then ( result => {
219
219
eventId = result ;
220
220
} ) ,
221
221
) ;
@@ -629,13 +629,13 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
629
629
*
630
630
* @param event The original event.
631
631
* @param hint May contain additional information about the original exception.
632
- * @param scope A scope containing event metadata.
632
+ * @param currentScope A scope containing event metadata.
633
633
* @returns A new event with more information.
634
634
*/
635
635
protected _prepareEvent (
636
636
event : Event ,
637
637
hint : EventHint ,
638
- scope ?: Scope ,
638
+ currentScope ?: Scope ,
639
639
isolationScope = getIsolationScope ( ) ,
640
640
) : PromiseLike < Event | null > {
641
641
const options = this . getOptions ( ) ;
@@ -646,14 +646,14 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
646
646
647
647
this . emit ( 'preprocessEvent' , event , hint ) ;
648
648
649
- return prepareEvent ( options , event , hint , scope , this , isolationScope ) . then ( evt => {
649
+ return prepareEvent ( options , event , hint , currentScope , this , isolationScope ) . then ( evt => {
650
650
if ( evt === null ) {
651
651
return evt ;
652
652
}
653
653
654
654
const propagationContext = {
655
655
...isolationScope . getPropagationContext ( ) ,
656
- ...( scope ? scope . getPropagationContext ( ) : undefined ) ,
656
+ ...( currentScope ? currentScope . getPropagationContext ( ) : undefined ) ,
657
657
} ;
658
658
659
659
const trace = evt . contexts && evt . contexts . trace ;
@@ -716,10 +716,10 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
716
716
*
717
717
* @param event The event to send to Sentry.
718
718
* @param hint May contain additional information about the original exception.
719
- * @param scope A scope containing event metadata.
719
+ * @param currentScope A scope containing event metadata.
720
720
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
721
721
*/
722
- protected _processEvent ( event : Event , hint : EventHint , scope ?: Scope ) : PromiseLike < Event > {
722
+ protected _processEvent ( event : Event , hint : EventHint , currentScope ?: Scope ) : PromiseLike < Event > {
723
723
const options = this . getOptions ( ) ;
724
724
const { sampleRate } = options ;
725
725
@@ -747,7 +747,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
747
747
const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
748
748
const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
749
749
750
- return this . _prepareEvent ( event , hint , scope , capturedSpanIsolationScope )
750
+ return this . _prepareEvent ( event , hint , currentScope , capturedSpanIsolationScope )
751
751
. then ( prepared => {
752
752
if ( prepared === null ) {
753
753
this . recordDroppedEvent ( 'event_processor' , dataCategory , event ) ;
@@ -768,7 +768,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
768
768
throw new SentryError ( `${ beforeSendLabel } returned \`null\`, will not send event.` , 'log' ) ;
769
769
}
770
770
771
- const session = scope && scope . getSession ( ) ;
771
+ const session = currentScope && currentScope . getSession ( ) ;
772
772
if ( ! isTransaction && session ) {
773
773
this . _updateSessionFromEvent ( session , processedEvent ) ;
774
774
}
0 commit comments