11/* eslint-disable @typescript-eslint/no-unsafe-member-access */ 
2- import  {  Event ,  EventProcessor ,  Hub ,  Integration ,  Primitive ,  Severity ,   EventHint  }  from  '@sentry/types' ; 
2+ import  {  Event ,  EventHint ,   EventProcessor ,  Hub ,  Integration ,  Primitive ,  Severity  }  from  '@sentry/types' ; 
33import  { 
44  addExceptionMechanism , 
55  addInstrumentationHandler , 
@@ -13,11 +13,11 @@ import {
1313import  {  eventFromUnknownInput  }  from  '../eventbuilder' ; 
1414import  {  shouldIgnoreOnError  }  from  '../helpers' ; 
1515
16+ const  ONUNHANDLEDREJECTION  =  'onunhandledrejection' ; 
17+ const  ONERROR  =  'onerror' ; 
18+ 
1619/** JSDoc */ 
17- interface  GlobalHandlersIntegrations  { 
18-   onerror : boolean ; 
19-   onunhandledrejection : boolean ; 
20- } 
20+ type  GlobalHandlersIntegrations  =  Record < typeof  ONUNHANDLEDREJECTION  |  typeof  ONERROR ,  boolean > ; 
2121
2222/** Global handlers */ 
2323export  class  GlobalHandlers  implements  Integration  { 
@@ -62,15 +62,15 @@ export class GlobalHandlers implements Integration {
6262    const  attachStacktrace  =  client  &&  client . getOptions ( ) . attachStacktrace ; 
6363
6464    if  ( this . _options . onerror  &&  ! this . _onErrorHandlerInstalled )  { 
65-       globalHandlerLog ( 'onerror' ) ; 
6665      _installGlobalOnErrorHandler ( hub ,  attachStacktrace ) ; 
6766      this . _onErrorHandlerInstalled  =  true ; 
67+       globalHandlerLog ( ONERROR ) ; 
6868    } 
6969
7070    if  ( this . _options . onunhandledrejection  &&  ! this . _onUnhandledRejectionHandlerInstalled )  { 
71-       globalHandlerLog ( 'onunhandledrejection' ) ; 
7271      _installGlobalOnUnhandledRejectionHandler ( hub ,  attachStacktrace ) ; 
7372      this . _onUnhandledRejectionHandlerInstalled  =  true ; 
73+       globalHandlerLog ( ONUNHANDLEDREJECTION ) ; 
7474    } 
7575  } 
7676} 
@@ -100,7 +100,7 @@ function _installGlobalOnErrorHandler(hub: Hub, attachStacktrace: boolean | unde
100100              data . column , 
101101            ) ; 
102102
103-       addMechanismAndCapture ( hub ,  error ,  event ,  'onerror' ) ; 
103+       addMechanismAndCapture ( hub ,  error ,  event ,  ONERROR ) ; 
104104    } , 
105105    type : 'error' , 
106106  } ) ; 
@@ -146,7 +146,7 @@ function _installGlobalOnUnhandledRejectionHandler(hub: Hub, attachStacktrace: b
146146
147147      event . level  =  Severity . Error ; 
148148
149-       addMechanismAndCapture ( hub ,  error ,  event ,  'onunhandledrejection' ) ; 
149+       addMechanismAndCapture ( hub ,  error ,  event ,  ONUNHANDLEDREJECTION ) ; 
150150      return ; 
151151    } , 
152152    type : 'unhandledrejection' , 
0 commit comments