Skip to content

Commit 829a313

Browse files
committed
[DevTools] Include stack of cause in React instrumentation errors
1 parent 534bed5 commit 829a313

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

packages/react-client/src/ReactFlightClientDevToolsHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function injectInternals(internals: Object): boolean {
3030
} catch (err) {
3131
// Catch all errors because it is unsafe to throw during initialization.
3232
if (__DEV__) {
33-
console.error('React instrumentation encountered an error: %s.', err);
33+
console.error('React instrumentation encountered an error: %o.', err);
3434
}
3535
}
3636
if (hook.checkDCE) {

packages/react-devtools-shared/src/__tests__/setupTests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function patchConsoleForTestingBeforeHookInstallation() {
141141
// if they use this code path.
142142
firstArg = firstArg.slice(9);
143143
}
144-
if (firstArg === 'React instrumentation encountered an error: %s') {
144+
if (firstArg === 'React instrumentation encountered an error: %o') {
145145
// Rethrow errors from React.
146146
throw args[1];
147147
} else if (

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2935,7 +2935,7 @@ export function attach(
29352935
}
29362936
if (suspenseNode.parent !== parentNode) {
29372937
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.',
29392939
);
29402940
}
29412941
let previousSuspenseSibling = remainingReconcilingChildrenSuspenseNodes;

packages/react-reconciler/src/ReactFiberDevToolsHook.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function injectInternals(internals: Object): boolean {
7878
} catch (err) {
7979
// Catch all errors because it is unsafe to throw during initialization.
8080
if (__DEV__) {
81-
console.error('React instrumentation encountered an error: %s.', err);
81+
console.error('React instrumentation encountered an error: %o.', err);
8282
}
8383
}
8484
if (hook.checkDCE) {
@@ -101,7 +101,7 @@ export function onScheduleRoot(root: FiberRoot, children: ReactNodeList) {
101101
} catch (err) {
102102
if (__DEV__ && !hasLoggedError) {
103103
hasLoggedError = true;
104-
console.error('React instrumentation encountered an error: %s', err);
104+
console.error('React instrumentation encountered an error: %o', err);
105105
}
106106
}
107107
}
@@ -144,7 +144,7 @@ export function onCommitRoot(root: FiberRoot, eventPriority: EventPriority) {
144144
if (__DEV__) {
145145
if (!hasLoggedError) {
146146
hasLoggedError = true;
147-
console.error('React instrumentation encountered an error: %s', err);
147+
console.error('React instrumentation encountered an error: %o', err);
148148
}
149149
}
150150
}
@@ -162,7 +162,7 @@ export function onPostCommitRoot(root: FiberRoot) {
162162
if (__DEV__) {
163163
if (!hasLoggedError) {
164164
hasLoggedError = true;
165-
console.error('React instrumentation encountered an error: %s', err);
165+
console.error('React instrumentation encountered an error: %o', err);
166166
}
167167
}
168168
}
@@ -177,7 +177,7 @@ export function onCommitUnmount(fiber: Fiber) {
177177
if (__DEV__) {
178178
if (!hasLoggedError) {
179179
hasLoggedError = true;
180-
console.error('React instrumentation encountered an error: %s', err);
180+
console.error('React instrumentation encountered an error: %o', err);
181181
}
182182
}
183183
}
@@ -199,7 +199,7 @@ export function setIsStrictModeForDevtools(newIsStrictMode: boolean) {
199199
if (__DEV__) {
200200
if (!hasLoggedError) {
201201
hasLoggedError = true;
202-
console.error('React instrumentation encountered an error: %s', err);
202+
console.error('React instrumentation encountered an error: %o', err);
203203
}
204204
}
205205
}

0 commit comments

Comments
 (0)