Skip to content

Commit e60fe99

Browse files
HazATkamilogorek
andauthored
Apply suggestions from code review
Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com>
1 parent 8387ed3 commit e60fe99

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

packages/browser/src/client.ts

+11-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { DsnLike, Event, EventHint } from '@sentry/types';
33
import { getGlobalObject, logger } from '@sentry/utils';
44

55
import { BrowserBackend, BrowserOptions } from './backend';
6-
import { Breadcrumbs } from './integrations/index';
6+
import { Breadcrumbs } from './integrations';
77
import { SDK_NAME, SDK_VERSION } from './version';
88

99
/**
@@ -79,22 +79,20 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
7979

8080
this._processEvent(event, hint, scope)
8181
.then(finalEvent => {
82-
// We need to check for finalEvent in case beforeSend returned null
83-
eventId = finalEvent && finalEvent.event_id;
82+
// We need to check for finalEvent in case beforeSend returned null.
83+
if (!finalEvent) {
84+
return;
85+
}
86+
eventId = finalEvent.event_id;
8487
// We do this here to not parse any requests if they are outgoing to Sentry
8588
// We log breadcrumbs if the integration has them enabled
86-
if (finalEvent) {
87-
const integration = this.getIntegration(Breadcrumbs);
88-
if (integration) {
89-
integration.addSentryBreadcrumb(finalEvent);
90-
}
89+
const integration = this.getIntegration(Breadcrumbs);
90+
if (integration) {
91+
integration.addSentryBreadcrumb(finalEvent);
9192
}
92-
this._processing = false;
9393
})
94-
.then(null, reason => {
95-
logger.error(reason);
96-
this._processing = false;
97-
});
94+
.catch(reason => logger.error(reason))
95+
.finally(() => (this._processing = false));
9896

9997
return eventId;
10098
}

0 commit comments

Comments
 (0)