@@ -17,6 +17,7 @@ import type {
1717 Integration ,
1818 Outcome ,
1919 ParameterizedString ,
20+ Scope ,
2021 SdkMetadata ,
2122 Session ,
2223 SessionAggregates ,
@@ -52,7 +53,6 @@ import { createEventEnvelope, createSessionEnvelope } from './envelope';
5253import type { IntegrationIndex } from './integration' ;
5354import { afterSetupIntegrations } from './integration' ;
5455import { setupIntegration , setupIntegrations } from './integration' ;
55- import type { Scope } from './scope' ;
5656import { updateSession } from './session' ;
5757import { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext' ;
5858import { parseSampleRate } from './utils/parseSampleRate' ;
@@ -151,7 +151,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
151151 * @inheritDoc
152152 */
153153 // 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 {
155155 // ensure we haven't captured this very object before
156156 if ( checkOrSetAlreadyCaught ( exception ) ) {
157157 DEBUG_BUILD && logger . log ( ALREADY_SEEN_ERROR ) ;
@@ -162,7 +162,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
162162
163163 this . _process (
164164 this . eventFromException ( exception , hint )
165- . then ( event => this . _captureEvent ( event , hint , scope ) )
165+ . then ( event => this . _captureEvent ( event , hint , currentScope ) )
166166 . then ( result => {
167167 eventId = result ;
168168 } ) ,
@@ -178,7 +178,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
178178 message : ParameterizedString ,
179179 level ?: SeverityLevel ,
180180 hint ?: EventHint ,
181- scope ?: Scope ,
181+ currentScope ?: Scope ,
182182 ) : string | undefined {
183183 let eventId : string | undefined = hint && hint . event_id ;
184184
@@ -190,7 +190,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
190190
191191 this . _process (
192192 promisedEvent
193- . then ( event => this . _captureEvent ( event , hint , scope ) )
193+ . then ( event => this . _captureEvent ( event , hint , currentScope ) )
194194 . then ( result => {
195195 eventId = result ;
196196 } ) ,
@@ -202,7 +202,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
202202 /**
203203 * @inheritDoc
204204 */
205- public captureEvent ( event : Event , hint ?: EventHint , scope ?: Scope ) : string | undefined {
205+ public captureEvent ( event : Event , hint ?: EventHint , currentScope ?: Scope ) : string | undefined {
206206 // ensure we haven't captured this very object before
207207 if ( hint && hint . originalException && checkOrSetAlreadyCaught ( hint . originalException ) ) {
208208 DEBUG_BUILD && logger . log ( ALREADY_SEEN_ERROR ) ;
@@ -215,7 +215,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
215215 const capturedSpanScope : Scope | undefined = sdkProcessingMetadata . capturedSpanScope ;
216216
217217 this . _process (
218- this . _captureEvent ( event , hint , capturedSpanScope || scope ) . then ( result => {
218+ this . _captureEvent ( event , hint , capturedSpanScope || currentScope ) . then ( result => {
219219 eventId = result ;
220220 } ) ,
221221 ) ;
@@ -629,13 +629,13 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
629629 *
630630 * @param event The original event.
631631 * @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.
633633 * @returns A new event with more information.
634634 */
635635 protected _prepareEvent (
636636 event : Event ,
637637 hint : EventHint ,
638- scope ?: Scope ,
638+ currentScope ?: Scope ,
639639 isolationScope = getIsolationScope ( ) ,
640640 ) : PromiseLike < Event | null > {
641641 const options = this . getOptions ( ) ;
@@ -646,14 +646,14 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
646646
647647 this . emit ( 'preprocessEvent' , event , hint ) ;
648648
649- return prepareEvent ( options , event , hint , scope , this , isolationScope ) . then ( evt => {
649+ return prepareEvent ( options , event , hint , currentScope , this , isolationScope ) . then ( evt => {
650650 if ( evt === null ) {
651651 return evt ;
652652 }
653653
654654 const propagationContext = {
655655 ...isolationScope . getPropagationContext ( ) ,
656- ...( scope ? scope . getPropagationContext ( ) : undefined ) ,
656+ ...( currentScope ? currentScope . getPropagationContext ( ) : undefined ) ,
657657 } ;
658658
659659 const trace = evt . contexts && evt . contexts . trace ;
@@ -716,10 +716,10 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
716716 *
717717 * @param event The event to send to Sentry.
718718 * @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.
720720 * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
721721 */
722- protected _processEvent ( event : Event , hint : EventHint , scope ?: Scope ) : PromiseLike < Event > {
722+ protected _processEvent ( event : Event , hint : EventHint , currentScope ?: Scope ) : PromiseLike < Event > {
723723 const options = this . getOptions ( ) ;
724724 const { sampleRate } = options ;
725725
@@ -747,7 +747,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
747747 const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
748748 const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
749749
750- return this . _prepareEvent ( event , hint , scope , capturedSpanIsolationScope )
750+ return this . _prepareEvent ( event , hint , currentScope , capturedSpanIsolationScope )
751751 . then ( prepared => {
752752 if ( prepared === null ) {
753753 this . recordDroppedEvent ( 'event_processor' , dataCategory , event ) ;
@@ -768,7 +768,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
768768 throw new SentryError ( `${ beforeSendLabel } returned \`null\`, will not send event.` , 'log' ) ;
769769 }
770770
771- const session = scope && scope . getSession ( ) ;
771+ const session = currentScope && currentScope . getSession ( ) ;
772772 if ( ! isTransaction && session ) {
773773 this . _updateSessionFromEvent ( session , processedEvent ) ;
774774 }
0 commit comments