From 19a73a23b78b17c99467943159d253120642e0fd Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 6 Mar 2024 21:18:44 +0000 Subject: [PATCH 1/2] fix(types): Add `addScopeListener` to `Scope` interface --- packages/types/src/scope.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/types/src/scope.ts b/packages/types/src/scope.ts index 39e93f8ac1df..c5a5daa25241 100644 --- a/packages/types/src/scope.ts +++ b/packages/types/src/scope.ts @@ -61,6 +61,12 @@ export interface Scope { */ getClient(): C | undefined; + /** + * Add internal on change listener. Used for sub SDKs that need to store the scope. + * @hidden + */ + addScopeListener(callback: (scope: Scope) => void): void; + /** Add new event processor that will be called during event processing. */ addEventProcessor(callback: EventProcessor): this; From 9ddd73c0030e009624c6cef84f05bd69c3bd6e78 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 6 Mar 2024 21:23:59 +0000 Subject: [PATCH 2/2] Use @inheritDoc for all implemented methods --- packages/core/src/scope.ts | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/packages/core/src/scope.ts b/packages/core/src/scope.ts index 820e41858135..96ab7080e8c6 100644 --- a/packages/core/src/scope.ts +++ b/packages/core/src/scope.ts @@ -121,7 +121,7 @@ export class Scope implements ScopeInterface { } /** - * Clone this scope instance. + * @inheritDoc */ public clone(): Scope { const newScope = new Scope(); @@ -145,23 +145,22 @@ export class Scope implements ScopeInterface { return newScope; } - /** Update the client on the scope. */ + /** + * @inheritDoc + */ public setClient(client: Client | undefined): void { this._client = client; } /** - * Get the client assigned to this scope. - * - * It is generally recommended to use the global function `Sentry.getClient()` instead, unless you know what you are doing. + * @inheritDoc */ public getClient(): C | undefined { return this._client as C | undefined; } /** - * Add internal on change listener. Used for sub SDKs that need to store the scope. - * @hidden + * @inheritDoc */ public addScopeListener(callback: (scope: Scope) => void): void { this._scopeListeners.push(callback); @@ -542,7 +541,7 @@ export class Scope implements ScopeInterface { } /** - * Add data which will be accessible during event processing but won't get sent to Sentry + * @inheritDoc */ public setSDKProcessingMetadata(newData: { [key: string]: unknown }): this { this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData }; @@ -566,11 +565,7 @@ export class Scope implements ScopeInterface { } /** - * Capture an exception for this scope. - * - * @param exception The exception to capture. - * @param hint Optinal additional data to attach to the Sentry event. - * @returns the id of the captured Sentry event. + * @inheritDoc */ public captureException(exception: unknown, hint?: EventHint): string { const eventId = hint && hint.event_id ? hint.event_id : uuid4(); @@ -597,12 +592,7 @@ export class Scope implements ScopeInterface { } /** - * Capture a message for this scope. - * - * @param message The message to capture. - * @param level An optional severity level to report the message with. - * @param hint Optional additional data to attach to the Sentry event. - * @returns the id of the captured message. + * @inheritDoc */ public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string { const eventId = hint && hint.event_id ? hint.event_id : uuid4(); @@ -630,11 +620,7 @@ export class Scope implements ScopeInterface { } /** - * Captures a manually created event for this scope and sends it to Sentry. - * - * @param exception The event to capture. - * @param hint Optional additional data to attach to the Sentry event. - * @returns the id of the captured event. + * @inheritDoc */ public captureEvent(event: Event, hint?: EventHint): string { const eventId = hint && hint.event_id ? hint.event_id : uuid4();