Skip to content

Commit e5eed45

Browse files
committed
PR comments
1 parent 1443452 commit e5eed45

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/react-native/Libraries/promiseRejectionTrackingOptions.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import typeof {enable} from 'promise/setimmediate/rejection-tracking';
1212

13-
const LogBox = require('./LogBox/LogBox').default;
13+
import LogBox from './LogBox/LogBox';
1414

1515
let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
1616
allRejections: true,
@@ -25,24 +25,24 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
2525
message = Error.prototype.toString.call(rejection);
2626
const error: Error = (rejection: $FlowFixMe);
2727

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
3429
if (__DEV__) {
3530
LogBox.addLog({
3631
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+
},
3838
componentStack: [],
3939
stack: error.stack,
4040
category: 'possible_unhandled_promise_rejection',
4141
});
4242

4343
return;
4444
} else {
45-
console.warn(warning);
45+
stack = error.stack;
4646
}
4747
} else {
4848
try {

0 commit comments

Comments
 (0)