dillon1000/react
Commit
Browse files Support throwing null (#10213)
* Support throwing null In JavaScript, you can throw values of any type, not just errors. That includes null. We currently rely on null checks to determine if a user- provided function has thrown. This refactors our error handling code to keep track of an explicit boolean flag instead. * Add DOM fixture test case for break on exception behavior * preventDefault error events during feature test We call invokeGuardedCallbackDev at startup as part of a feature test. But we don't want those errors to log to the console. * Add throwing null test case * Use ReactFeatureFlags instead of ReactDOMFeatureFlags React ART uses this, too. * Non-errors in error logger If a non-error is thrown, we'll coerce the value to a string and use that as the message.
Changed paths11 files
First-parent comparisonfixtures/dom/src/components/Header.js ModifiedA fixtures/dom/src/components/fixtures/error-handling/index.js AddedM fixtures/dom/src/components/fixtures/index.js ModifiedM scripts/fiber/tests-passing.txt ModifiedM scripts/jest/fiber.setup.js ModifiedM src/renderers/shared/fiber/ReactFiberCommitWork.js ModifiedM src/renderers/shared/fiber/ReactFiberErrorLogger.js ModifiedM src/renderers/shared/fiber/ReactFiberScheduler.js ModifiedM src/renderers/shared/utils/ReactErrorUtils.js ModifiedM src/renderers/shared/utils/ReactFeatureFlags.js ModifiedM src/renderers/shared/utils/__tests__/ReactErrorUtils-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…