Skip to content

Commit 0adc28b

Browse files
committed
ref: Check whether client is enabled for reportDialog and log instead of throw
1 parent 83c2f02 commit 0adc28b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/browser/src/client.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { API, BaseClient, Scope, SentryError } from '@sentry/core';
1+
import { API, BaseClient, Scope } from '@sentry/core';
22
import { DsnLike, SentryEvent, SentryEventHint } from '@sentry/types';
3+
import { logger } from '@sentry/utils/logger';
34
import { getGlobalObject } from '@sentry/utils/misc';
45
import { BrowserBackend, BrowserOptions } from './backend';
56
import { SDK_NAME, SDK_VERSION } from './version';
@@ -78,14 +79,21 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
7879
return;
7980
}
8081

82+
if (!this.isEnabled()) {
83+
logger.error('Trying to call showReportDialog with Sentry Client is disabled');
84+
return;
85+
}
86+
8187
const dsn = options.dsn || this.getDsn();
8288

8389
if (!options.eventId) {
84-
throw new SentryError('Missing `eventId` option in showReportDialog call');
90+
logger.error('Missing `eventId` option in showReportDialog call');
91+
return;
8592
}
8693

8794
if (!dsn) {
88-
throw new SentryError('Missing `Dsn` option in showReportDialog call');
95+
logger.error('Missing `Dsn` option in showReportDialog call');
96+
return;
8997
}
9098

9199
const script = document.createElement('script');

0 commit comments

Comments
 (0)