Skip to content

Commit 5194442

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 c78789d commit 5194442

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,
@@ -52,6 +51,7 @@ export { getCurrentHub, makeMain } from './sdk/hub';
5251

5352
export {
5453
addBreadcrumb,
54+
isInitialized,
5555
makeNodeTransport,
5656
defaultStackParser,
5757
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

1919
import type { ExclusiveEventHintOrCaptureContext } from '../utils/prepareEvent';
2020
import { parseEventHintOrCaptureContext } from '../utils/prepareEvent';
21-
import { getClient, getCurrentScope, getIsolationScope, isInitialized } from './scope';
21+
import { getClient, getCurrentScope, getIsolationScope } from './scope';
2222

23-
export { getCurrentScope, getIsolationScope, getClient, isInitialized };
23+
export { getCurrentScope, 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
@@ -46,11 +46,6 @@ export function getClient<C extends Client>(): C {
4646
return {} as C;
4747
}
4848

49-
/** If the SDK was initialized. */
50-
export function isInitialized(): boolean {
51-
return !!getClient().getDsn();
52-
}
53-
5449
function getScopes(): CurrentScopes {
5550
const carrier = getGlobalCarrier();
5651

0 commit comments

Comments
 (0)