Skip to content

Commit 5edaca4

Browse files
committed
remove dead enum & provide component name in error message
1 parent b7ecfdf commit 5edaca4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3614,10 +3614,14 @@ export function attach(
36143614
// Log error & cause for user to debug
36153615
console.error(message + '\n\n', error);
36163616
if (error.cause != null) {
3617+
const fiber = findCurrentFiberUsingSlowPathById(id);
3618+
const componentName =
3619+
fiber != null ? getDisplayNameForFiber(fiber) : null;
36173620
console.error(
36183621
'React DevTools encountered an error while trying to inspect hooks. ' +
3619-
'This is most likely caused by an error in current inspected component.' +
3620-
'The error thrown in the component is: \n\n',
3622+
'This is most likely caused by an error in current inspected component' +
3623+
(componentName != null ? `: "${componentName}".` : '.') +
3624+
'\nThe error thrown in the component is: \n\n',
36213625
error.cause,
36223626
);
36233627
if (error.cause instanceof Error) {
@@ -3643,7 +3647,9 @@ export function attach(
36433647
errorType: 'unknown-hook',
36443648
id,
36453649
responseID: requestID,
3646-
message: 'Unsupported feature: ' + error.message,
3650+
message:
3651+
'Unsupported hook in the react-debug-tools package: ' +
3652+
error.message,
36473653
};
36483654
}
36493655

packages/react-devtools-shared/src/devtools/views/Components/types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export type OwnersList = {|
6363

6464
export type InspectedElementResponseType =
6565
| 'error'
66-
| 'user-error'
6766
| 'full-data'
6867
| 'hydrated-path'
6968
| 'no-change'

0 commit comments

Comments
 (0)