Keep promise rejections unhandled after catching them for logging

Summary: Tracked component catches rejected promises under it to log them. After catching promises become "handled". This might hide potential promise error handling mistakes, so it's better to ensure we keep promises unhandled after catching them for tracking, so they are properly catched by the unhandled promise handler after that. The easiest solution seems to just make new rejected promise and return it instead of the catched one.

Reviewed By: passy

Differential Revision: D28466570

fbshipit-source-id: 26c1e7af3d6e4f7067b95f20e646462d808bb497
This commit is contained in:
Anton Nikolaev
2021-05-18 08:06:07 -07:00
committed by Facebook GitHub Bot
parent a4eb2a56d6
commit 8bbf9c46a3
2 changed files with 6 additions and 2 deletions

View File

@@ -187,7 +187,7 @@ function init() {
if (!isProduction()) {
const msg = `[interaction] ${r.scope}:${r.action} in ${r.duration}ms`;
if (r.success) console.log(msg);
else console.error(msg, r.error);
else console.warn(msg, r.error);
}
});
ReactDOM.render(