@@ -3,7 +3,7 @@ import { DsnLike, Event, EventHint } from '@sentry/types';
3
3
import { getGlobalObject , logger } from '@sentry/utils' ;
4
4
5
5
import { BrowserBackend , BrowserOptions } from './backend' ;
6
- import { Breadcrumbs } from './integrations/index ' ;
6
+ import { Breadcrumbs } from './integrations' ;
7
7
import { SDK_NAME , SDK_VERSION } from './version' ;
8
8
9
9
/**
@@ -79,22 +79,20 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
79
79
80
80
this . _processEvent ( event , hint , scope )
81
81
. 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 ;
84
87
// We do this here to not parse any requests if they are outgoing to Sentry
85
88
// 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 ) ;
91
92
}
92
- this . _processing = false ;
93
93
} )
94
- . then ( null , reason => {
95
- logger . error ( reason ) ;
96
- this . _processing = false ;
97
- } ) ;
94
+ . catch ( reason => logger . error ( reason ) )
95
+ . finally ( ( ) => ( this . _processing = false ) ) ;
98
96
99
97
return eventId ;
100
98
}
0 commit comments