@samitouri / QOS-React-1 / commits / 379a083b9a

Include stack of cause in React instrumentation errors (#34198)

Sebastian "Sebbie" Silbermann committed Aug 13, 2025 at 19:18 UTC 379a083b9a95b0409cff4771bd9887e9e589777b
4 files changed +9 -9
packages/react-client/src/ReactFlightClientDevToolsHook.js
+1 -1
@@ -30,7 +30,7 @@ export function injectInternals(internals: Object): boolean {
30 } catch (err) {
31 // Catch all errors because it is unsafe to throw during initialization.
32 if (__DEV__) {
33 - console.error('React instrumentation encountered an error: %s.', err);
33 + console.error('React instrumentation encountered an error: %o.', err);
34 }
35 }
36 if (hook.checkDCE) {
packages/react-devtools-shared/src/__tests__/setupTests.js
+1 -1
@@ -141,7 +141,7 @@ function patchConsoleForTestingBeforeHookInstallation() {
141 // if they use this code path.
142 firstArg = firstArg.slice(9);
143 }
144 - if (firstArg === 'React instrumentation encountered an error: %s') {
144 + if (firstArg === 'React instrumentation encountered an error: %o') {
145 // Rethrow errors from React.
146 throw args[1];
147 } else if (
packages/react-devtools-shared/src/backend/fiber/renderer.js
+1 -1
@@ -2935,7 +2935,7 @@ export function attach(
2935 }
2936 if (suspenseNode.parent !== parentNode) {
2937 throw new Error(
2938 - 'Cannot remove a node from a different parent than is being reconciled.',
2938 + 'Cannot remove a Suspense node from a different parent than is being reconciled.',
2939 );
2940 }
2941 let previousSuspenseSibling = remainingReconcilingChildrenSuspenseNodes;
packages/react-reconciler/src/ReactFiberDevToolsHook.js
+6 -6
@@ -78,7 +78,7 @@ export function injectInternals(internals: Object): boolean {
78 } catch (err) {
79 // Catch all errors because it is unsafe to throw during initialization.
80 if (__DEV__) {
81 - console.error('React instrumentation encountered an error: %s.', err);
81 + console.error('React instrumentation encountered an error: %o.', err);
82 }
83 }
84 if (hook.checkDCE) {
@@ -101,7 +101,7 @@ export function onScheduleRoot(root: FiberRoot, children: ReactNodeList) {
101 } catch (err) {
102 if (__DEV__ && !hasLoggedError) {
103 hasLoggedError = true;
104 - console.error('React instrumentation encountered an error: %s', err);
104 + console.error('React instrumentation encountered an error: %o', err);
105 }
106 }
107 }
@@ -144,7 +144,7 @@ export function onCommitRoot(root: FiberRoot, eventPriority: EventPriority) {
144 if (__DEV__) {
145 if (!hasLoggedError) {
146 hasLoggedError = true;
147 - console.error('React instrumentation encountered an error: %s', err);
147 + console.error('React instrumentation encountered an error: %o', err);
148 }
149 }
150 }
@@ -162,7 +162,7 @@ export function onPostCommitRoot(root: FiberRoot) {
162 if (__DEV__) {
163 if (!hasLoggedError) {
164 hasLoggedError = true;
165 - console.error('React instrumentation encountered an error: %s', err);
165 + console.error('React instrumentation encountered an error: %o', err);
166 }
167 }
168 }
@@ -177,7 +177,7 @@ export function onCommitUnmount(fiber: Fiber) {
177 if (__DEV__) {
178 if (!hasLoggedError) {
179 hasLoggedError = true;
180 - console.error('React instrumentation encountered an error: %s', err);
180 + console.error('React instrumentation encountered an error: %o', err);
181 }
182 }
183 }
@@ -199,7 +199,7 @@ export function setIsStrictModeForDevtools(newIsStrictMode: boolean) {
199 if (__DEV__) {
200 if (!hasLoggedError) {
201 hasLoggedError = true;
202 - console.error('React instrumentation encountered an error: %s', err);
202 + console.error('React instrumentation encountered an error: %o', err);
203 }
204 }
205 }