Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handle undefined Error stacks in DevTools error boundary #24065

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ export default class ErrorBoundary extends Component<Props, State> {
const errorMessage =
typeof error === 'object' &&
error !== null &&
error.hasOwnProperty('message')
typeof error.message === 'string'
? error.message
: String(error);
: null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change prevents us from searching for a matching GitHub issue when we have no unique error message to search with.


const isTimeout = error instanceof TimeoutError;

const callStack =
typeof error === 'object' &&
error !== null &&
error.hasOwnProperty('stack')
typeof error.stack === 'string'
Copy link
Contributor Author

@bvaughn bvaughn Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change prevents us from trying to call String.prototype.split on a non-string value (in the bug report case, undefined).

? error.stack
.split('\n')
.slice(1)
Expand Down