Skip to content

Commit 3b2c849

Browse files
committed
ref(node-experimental): Remove custom isInitialized
We have this in core now, and align the implementation there to work consistently (and also in a future where a client may not be undefined).
1 parent 3ef44a4 commit 3b2c849

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

packages/core/src/exports.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ export function getClient<C extends Client>(): C | undefined {
357357
* Returns true if Sentry has been properly initialized.
358358
*/
359359
export function isInitialized(): boolean {
360-
return !!getClient();
360+
const client = getClient();
361+
return !!client && !!client.getDsn();
361362
}
362363

363364
/**

packages/node-experimental/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export type { Span } from './types';
2929
export { startSpan, startSpanManual, startInactiveSpan, getActiveSpan } from '@sentry/opentelemetry';
3030
export {
3131
getClient,
32-
isInitialized,
3332
captureException,
3433
captureEvent,
3534
captureMessage,
@@ -55,6 +54,7 @@ export { Scope } from './sdk/scope';
5554

5655
export {
5756
addBreadcrumb,
57+
isInitialized,
5858
makeNodeTransport,
5959
defaultStackParser,
6060
getSentryRelease,

packages/node-experimental/src/sdk/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import { getContextFromScope, getScopesFromContext, setScopesOnContext } from '.
1818
import type { ExclusiveEventHintOrCaptureContext } from '../utils/prepareEvent';
1919
import { parseEventHintOrCaptureContext } from '../utils/prepareEvent';
2020
import type { Scope } from './scope';
21-
import { getClient, getCurrentScope, getGlobalScope, getIsolationScope, isInitialized } from './scope';
21+
import { getClient, getCurrentScope, getGlobalScope, getIsolationScope } from './scope';
2222

23-
export { getCurrentScope, getGlobalScope, getIsolationScope, getClient, isInitialized };
23+
export { getCurrentScope, getGlobalScope, getIsolationScope, getClient };
2424
export { setCurrentScope, setIsolationScope } from './scope';
2525

2626
/**

packages/node-experimental/src/sdk/scope.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ export function getClient<C extends Client>(): C {
6565
return {} as C;
6666
}
6767

68-
/** If the SDK was initialized. */
69-
export function isInitialized(): boolean {
70-
return !!getClient().getDsn();
71-
}
72-
7368
/** A fork of the classic scope with some otel specific stuff. */
7469
export class Scope extends OpenTelemetryScope implements ScopeInterface {
7570
protected _client: Client | undefined;

0 commit comments

Comments
 (0)