Skip to content

Commit 4c68c14

Browse files
author
Brian Vaughn
committed
Better handle undefined Error stacks in DevTools error boundary
1 parent 72a933d commit 4c68c14

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,18 @@ export default class ErrorBoundary extends Component<Props, State> {
4949
const errorMessage =
5050
typeof error === 'object' &&
5151
error !== null &&
52-
error.hasOwnProperty('message')
52+
error.hasOwnProperty('message') &&
53+
typeof error.message === 'string'
5354
? error.message
54-
: String(error);
55+
: null;
5556

5657
const isTimeout = error instanceof TimeoutError;
5758

5859
const callStack =
5960
typeof error === 'object' &&
6061
error !== null &&
61-
error.hasOwnProperty('stack')
62+
error.hasOwnProperty('stack') &&
63+
typeof error.stack === 'string'
6264
? error.stack
6365
.split('\n')
6466
.slice(1)

0 commit comments

Comments
 (0)