1
- import { ClientLike , Integration , ScopeContext } from '@sentry/types' ;
1
+ import { ClientLike , Integration } from '@sentry/types' ;
2
2
import { consoleSandbox } from '@sentry/utils' ;
3
3
4
4
import { logAndExitProcess } from './exit' ;
@@ -7,10 +7,6 @@ type UnhandledRejectionMode = 'none' | 'warn' | 'strict';
7
7
type OnUncaughtExceptionOptions = {
8
8
mode ?: UnhandledRejectionMode ;
9
9
} ;
10
- type PromiseRejectionWithDomainContext = {
11
- domain ?: { sentryContext ?: ScopeContext } ;
12
- } ;
13
-
14
10
const DEFAULT_REJECTION_MODE = 'warn' ;
15
11
16
12
export class OnUnhandledRejection implements Integration {
@@ -23,31 +19,12 @@ export class OnUnhandledRejection implements Integration {
23
19
global . process . on ( 'unhandledRejection' , handler ) ;
24
20
}
25
21
26
- public _makeRejectionHandler (
27
- client : ClientLike ,
28
- ) : ( reason : { stack ?: string } , promise : PromiseRejectionWithDomainContext ) => void {
29
- return ( reason : { stack ?: string } , promise : PromiseRejectionWithDomainContext ) : void => {
30
- const context = promise . domain ?. sentryContext || { } ;
31
-
32
- const scope : ScopeContext = { extra : { unhandledPromiseRejection : true } } ;
33
-
34
- // TODO: Validate whether its still necessary to keep it
35
- // Preserve backwards compatibility with raven-node for now
36
- if ( context . user ) {
37
- scope . user = context . user ;
38
- }
39
- if ( context . tags ) {
40
- scope . tags = context . tags ;
41
- }
42
- if ( context . extra ) {
43
- scope . extra = {
44
- ...scope . extra ,
45
- ...context . extra ,
46
- } ;
47
- }
48
-
49
- client . captureException ( reason , { hint : { originalException : promise } , scope } ) ;
50
-
22
+ public _makeRejectionHandler ( client : ClientLike ) : ( reason : { stack ?: string } , promise : unknown ) => void {
23
+ return ( reason : { stack ?: string } , promise : unknown ) : void => {
24
+ client . captureException ( reason , {
25
+ hint : { originalException : promise } ,
26
+ scope : { extra : { unhandledPromiseRejection : true } } ,
27
+ } ) ;
51
28
this . _handleRejection ( client , reason ) ;
52
29
} ;
53
30
}
0 commit comments