File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
packages/react-native/Libraries Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 10
10
11
11
import typeof { enable } from 'promise/setimmediate/rejection-tracking' ;
12
12
13
- const LogBox = require ( './LogBox/LogBox' ) . default ;
13
+ import LogBox from './LogBox/LogBox' ;
14
14
15
15
let rejectionTrackingOptions : $NonMaybeType < Parameters < enable > [ 0 ] > = {
16
16
allRejections : true ,
@@ -25,24 +25,24 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
25
25
message = Error . prototype . toString . call ( rejection ) ;
26
26
const error : Error = ( rejection : $FlowFixMe ) ;
27
27
28
- const warning =
29
- `Possible Unhandled Promise Rejection (id: ${ id } ):\n` +
30
- `${ message ?? '' } \n` +
31
- ( stack == null ? '' : stack ) ;
32
-
33
- // Print pretty unhandled rejections while on DEV
28
+ // Print correct unhandled rejections stack while on DEV
34
29
if ( __DEV__ ) {
35
30
LogBox . addLog ( {
36
31
level : 'warn' ,
37
- message : { content : warning , substitutions : [ ] } ,
32
+ message : {
33
+ content :
34
+ `Possible Unhandled Promise Rejection (id: ${ id } ):\n` +
35
+ `${ message ?? '' } \n` ,
36
+ substitutions : [ ] ,
37
+ } ,
38
38
componentStack : [ ] ,
39
39
stack : error . stack ,
40
40
category : 'possible_unhandled_promise_rejection' ,
41
41
} ) ;
42
42
43
43
return ;
44
44
} else {
45
- console . warn ( warning ) ;
45
+ stack = error . stack ;
46
46
}
47
47
} else {
48
48
try {
You can’t perform that action at this time.
0 commit comments