Skip to content

Commit 598eca8

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 cb6912a commit 598eca8

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
@@ -371,7 +371,8 @@ export function getClient<C extends Client>(): C | undefined {
371371
* Returns true if Sentry has been properly initialized.
372372
*/
373373
export function isInitialized(): boolean {
374-
return !!getClient();
374+
const client = getClient();
375+
return !!client && !!client.getDsn();
375376
}
376377

377378
/**

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
addBreadcrumb,
3433
captureException,
3534
captureEvent,
@@ -55,6 +54,7 @@ export { getCurrentHub, makeMain } from './sdk/hub';
5554
export { Scope } from './sdk/scope';
5655

5756
export {
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
@@ -21,9 +21,9 @@ import { getContextFromScope, getScopesFromContext, setScopesOnContext } from '.
2121
import type { ExclusiveEventHintOrCaptureContext } from '../utils/prepareEvent';
2222
import { parseEventHintOrCaptureContext } from '../utils/prepareEvent';
2323
import type { Scope } from './scope';
24-
import { getClient, getCurrentScope, getGlobalScope, getIsolationScope, isInitialized } from './scope';
24+
import { getClient, getCurrentScope, getGlobalScope, getIsolationScope } from './scope';
2525

26-
export { getCurrentScope, getGlobalScope, getIsolationScope, getClient, isInitialized };
26+
export { getCurrentScope, getGlobalScope, getIsolationScope, getClient };
2727
export { setCurrentScope, setIsolationScope } from './scope';
2828

2929
/**

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)