@@ -46,36 +46,15 @@ export class OnUnhandledRejection implements Integration {
4646 // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
4747 public sendUnhandledPromise ( reason : any , promise : any ) : void {
4848 const hub = getCurrentHub ( ) ;
49-
50- if ( ! hub . getIntegration ( OnUnhandledRejection ) ) {
51- this . _handleRejection ( reason ) ;
52- return ;
53- }
54-
55- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
56- const context = ( promise . domain && promise . domain . sentryContext ) || { } ;
57-
58- hub . withScope ( ( scope : Scope ) => {
59- scope . setExtra ( 'unhandledPromiseRejection' , true ) ;
60-
61- // Preserve backwards compatibility with raven-node for now
62- if ( context . user ) {
63- scope . setUser ( context . user ) ;
64- }
65- if ( context . tags ) {
66- scope . setTags ( context . tags ) ;
67- }
68- if ( context . extra ) {
69- scope . setExtras ( context . extra ) ;
70- }
71-
72- hub . captureException ( reason , {
73- originalException : promise ,
74- data : { mechanism : { handled : false , type : 'onunhandledrejection' } } ,
49+ if ( hub . getIntegration ( OnUnhandledRejection ) ) {
50+ hub . withScope ( ( scope : Scope ) => {
51+ scope . setExtra ( 'unhandledPromiseRejection' , true ) ;
52+ hub . captureException ( reason , {
53+ originalException : promise ,
54+ data : { mechanism : { handled : false , type : 'onunhandledrejection' } } ,
55+ } ) ;
7556 } ) ;
76- } ) ;
77- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
78-
57+ }
7958 this . _handleRejection ( reason ) ;
8059 }
8160
0 commit comments