Skip to content

Commit e6ec8d5

Browse files
committed
[v7] Change getDsn() method to regular client attribute
1 parent 27f8b43 commit e6ec8d5

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

packages/browser/src/sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export function showReportDialog(
139139
}
140140

141141
options.eventId = options.eventId ?? client.lastEventId();
142-
options.dsn = options.dsn ?? client.getDsn()?.toString();
142+
options.dsn = options.dsn ?? client.options.dsn;
143143

144144
if (client.options.enabled === false) {
145145
logger.error(`${errPrefix} disabled client`);

packages/core/src/baseclient.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export abstract class BaseClient<O extends Options> implements ClientLike<O> {
6767
public readonly options: O;
6868

6969
/** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */
70-
protected readonly _dsn?: Dsn;
70+
public readonly dsn?: Dsn;
7171

7272
/** Array of used integrations. */
7373
protected _integrations: IntegrationIndex = {};
@@ -94,7 +94,7 @@ export abstract class BaseClient<O extends Options> implements ClientLike<O> {
9494
this.options = options;
9595

9696
if (options.dsn) {
97-
this._dsn = new Dsn(options.dsn);
97+
this.dsn = new Dsn(options.dsn);
9898
}
9999

100100
this._transport = this._setupTransport();
@@ -118,11 +118,6 @@ export abstract class BaseClient<O extends Options> implements ClientLike<O> {
118118
this._eventProcessors.push(callback);
119119
}
120120

121-
// TODO: To be removed? Can be obtained from options
122-
public getDsn(): Dsn | undefined {
123-
return this._dsn;
124-
}
125-
126121
/**
127122
* @inheritDoc
128123
*/

packages/integration-node-breadcrumbs/src/http.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ function _createWrappedRequestMethodFactory(
9494
const requestArgs = normalizeRequestArgs(args);
9595
const requestOptions = requestArgs[0];
9696
const requestUrl = extractUrl(requestOptions);
97-
const dsn = client.getDsn();
9897

9998
// we don't want to record requests to Sentry as either breadcrumbs or spans, so just use the original method
100-
if (!dsn || requestUrl.includes(dsn.host)) {
99+
if (!client.dsn || requestUrl.includes(client.dsn?.host)) {
101100
return originalRequestMethod.apply(httpModule, requestArgs);
102101
}
103102

packages/types/src/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ import { Session } from './session';
1616
*/
1717
export interface ClientLike<O extends Options = Options> {
1818
options: O;
19+
dsn?: Dsn;
1920

2021
getScope(): ScopeLike;
2122
setScope(scope: ScopeLike): void;
2223
addEventProcessor(callback: EventProcessor): void;
23-
// TODO: To be removed? Can be obtained from options
24-
getDsn(): Dsn | undefined;
2524
lastEventId(): string | undefined;
2625

2726
captureException(exception: unknown, captureContext?: CaptureContext): string | undefined;

0 commit comments

Comments
 (0)