-
-
Notifications
You must be signed in to change notification settings - Fork 360
fix(android): Use componentStack as fallback for missing error stack traces #5965
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
Changes from 5 commits
abaf594
bc7535c
583c991
13b2959
8c77549
f5e7ddd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,6 +170,16 @@ function setupErrorUtilsGlobalHandler(): void { | |
| return; | ||
| } | ||
|
|
||
| // React render errors may arrive without useful frames in .stack but with a | ||
| // .componentStack (set by ReactFiberErrorDialog) that contains component | ||
| // locations with bundle offsets. Use componentStack as a fallback so | ||
| // eventFromException can extract frames with source locations. | ||
| // oxlint-disable-next-line typescript-eslint(no-unsafe-member-access) | ||
| if (error?.componentStack && (!error.stack || !hasStackFrames(error.stack))) { | ||
| // oxlint-disable-next-line typescript-eslint(no-unsafe-member-access) | ||
| error.stack = `${error.message || 'Error'}${error.componentStack}`; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we add an extra space between the parameters, so Error is not clued to the componentStack message? |
||
| } | ||
|
|
||
| const hint: EventHint = { | ||
| originalException: error, | ||
| attachments: getCurrentScope().getScopeData().attachments, | ||
|
|
@@ -211,3 +221,10 @@ function setupErrorUtilsGlobalHandler(): void { | |
| ); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if a stack trace string contains at least one frame line. | ||
| */ | ||
| function hasStackFrames(stack: unknown): boolean { | ||
| return typeof stack === 'string' && stack.includes('\n'); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||


Uh oh!
There was an error while loading. Please reload this page.