|
1 |
| -import { BaseClient, getCurrentHub, getEnvelopeEndpointWithUrlEncodedAuth, Scope, SDK_VERSION } from '@sentry/core'; |
| 1 | +import { BaseClient, getEnvelopeEndpointWithUrlEncodedAuth, Scope, SDK_VERSION } from '@sentry/core'; |
2 | 2 | import { ClientOptions, Event, EventHint, Options, Severity, SeverityLevel } from '@sentry/types';
|
3 |
| -import { createClientReportEnvelope, dsnToString, getEventDescription, logger, serializeEnvelope } from '@sentry/utils'; |
| 3 | +import { createClientReportEnvelope, dsnToString, logger, serializeEnvelope } from '@sentry/utils'; |
4 | 4 |
|
5 | 5 | import { eventFromException, eventFromMessage } from './eventbuilder';
|
6 | 6 | import { WINDOW } from './helpers';
|
@@ -101,27 +101,10 @@ export class BrowserClient extends BaseClient<BrowserClientOptions> {
|
101 | 101 | // bundles, if it is not used by the SDK.
|
102 | 102 | // This all sadly is a bit ugly, but we currently don't have a "pre-send" hook on the integrations so we do it this
|
103 | 103 | // way for now.
|
104 |
| - const breadcrumbIntegration = this.getIntegrationById(BREADCRUMB_INTEGRATION_ID) as Breadcrumbs | null; |
105 |
| - if ( |
106 |
| - breadcrumbIntegration && |
107 |
| - // We check for definedness of `options`, even though it is not strictly necessary, because that access to |
108 |
| - // `.sentry` below does not throw, in case users provided their own integration with id "Breadcrumbs" that does |
109 |
| - // not have an`options` field |
110 |
| - breadcrumbIntegration.options && |
111 |
| - breadcrumbIntegration.options.sentry |
112 |
| - ) { |
113 |
| - getCurrentHub().addBreadcrumb( |
114 |
| - { |
115 |
| - category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`, |
116 |
| - event_id: event.event_id, |
117 |
| - level: event.level, |
118 |
| - message: getEventDescription(event), |
119 |
| - }, |
120 |
| - { |
121 |
| - event, |
122 |
| - }, |
123 |
| - ); |
124 |
| - } |
| 104 | + const breadcrumbIntegration = this.getIntegrationById(BREADCRUMB_INTEGRATION_ID) as Breadcrumbs | undefined; |
| 105 | + // We check for definedness of `addSentryBreadcrumb` in case users provided their own integration with id |
| 106 | + // "Breadcrumbs" that does not have this function. |
| 107 | + breadcrumbIntegration?.addSentryBreadcrumb?.(event); |
125 | 108 |
|
126 | 109 | super.sendEvent(event, hint);
|
127 | 110 | }
|
|
0 commit comments