8000 fix(node): More relevant warning message when tracing extensions are … · vlad-zhukov/sentry-javascript@c20e0fb · GitHub
[go: up one dir, main page]

Skip to content

Commit c20e0fb

Browse files
authored
fix(node): More relevant warning message when tracing extensions are missing (getsentry#8820)
Closes getsentry#8624
1 parent 65df869 commit c20e0fb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/core/src/hub.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,19 @@ export class Hub implements HubInterface {
374374
const result = this._callExtensionMethod<Transaction>('startTransaction', context, customSamplingContext);
375375

376376
if (__DEBUG_BUILD__ && !result) {
377-
// eslint-disable-next-line no-console
378-
console.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
377+
const client = this.getClient();
378+
if (!client) {
379+
// eslint-disable-next-line no-console
380+
console.warn(
381+
"Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'",
382+
);
383+
} else {
384+
// eslint-disable-next-line no-console
385+
console.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
379386
Sentry.addTracingExtensions();
380387
Sentry.init({...});
381388
`);
389+
}
382390
}
383391

384392
return result;

0 commit comments

Comments
 (0)
0