dillon1000/react
Commit
Browse files [Scheduler] Re-throw unhandled errors (#19595)
Because `postTask` returns a promise, errors inside a `postTask` callback result in the promise being rejected. If we don't catch those errors, then the browser will report an "Unhandled promise rejection" error. This is a confusing message to see in the console, because the fact that `postTask` is a promise-based API is an implementation detail from the perspective of the developer. "Promise rejection" is a red herring. On the other hand, if we do catch those errors, then we need to report the error to the user in some other way. What we really want is the default error reporting behavior that a normal, non-Promise browser event gets. So, we'll re-throw inside `setTimeout`.
Changed paths2 files
First-parent comparisonpackages/scheduler/src/SchedulerPostTask.js ModifiedM packages/scheduler/src/__tests__/SchedulerPostTask-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…