From cb53808a4f0f8fb4a425f8fb3a572058fcd87646 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 9 Mar 2022 14:26:29 -0500 Subject: [PATCH] Better handle undefined Error stacks in DevTools error boundary --- .../src/devtools/views/ErrorBoundary/ErrorBoundary.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js b/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js index b78f7406ad172..06e187a4beec3 100644 --- a/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js +++ b/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js @@ -49,16 +49,16 @@ export default class ErrorBoundary extends Component { const errorMessage = typeof error === 'object' && error !== null && - error.hasOwnProperty('message') + typeof error.message === 'string' ? error.message - : String(error); + : null; const isTimeout = error instanceof TimeoutError; const callStack = typeof error === 'object' && error !== null && - error.hasOwnProperty('stack') + typeof error.stack === 'string' ? error.stack .split('\n') .slice(1)