-
Notifications
You must be signed in to change notification settings - Fork 37
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
Include error stack in <ErrorBoundary> #1512
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful, because it adds information. That's always good.
But in fact I'd been under the impression that I was seeing a lower-level stack than the one I wanted, which is at the component level! So you're adding the thing I thought I already had, and I already had (apparently) the thing I thought I wanted!
I gotta go and lie down.
lib/ErrorBoundary/ErrorBoundary.js
Outdated
${componentStack.toString()} | ||
`.split('\n') | ||
// Remove empty lines | ||
.filter(str => !!str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.filter(str => !!str); | |
.filter(Boolean); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.filter(Boolean);
Is using the Boolean
constructor in this way a common idiom? I mean, I get it, it works, it's a tiny bit shorter. But given .filter()
expects to receive a function and Boolean
looks nothing like a function, it seems less clear rather than more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it is kinda idiom. Met this many times.
Like https://michaeluloth.com/filter-boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who at that time could have known that the language for making falling snowflakes could become the world #1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is different, but unfortunately it's not actually better. I really appreciate the effort though! The error stack is definitely more interesting than the component stack but unless we can show source-mapped line numbers, it still isn't actionable information.
In development mode running yarn local
to serve from a workspace, the error stack shows line numbers from the bundle rather than from the original source, which is what we get in the console:
Likewise, in production when serving from a build with sourcemaps enabled, the "Error details" panel appears to still show the component stack. In order for that "Copy" button to copy actionable information, it would need to show the error stack with source-mapped line numbers like the console:
|
@zburke You are right – the development error could be a lot more precise. And the production error is basically useless because of the obfuscation. I found this issue where multiple sugested solutions: Here are some of them:
And correct, the modules are wrapped in stripes-core, but I noticed that wrapping the root of the module results in a more precise and relevant component stack (in development at least). |
This comment has been minimized.
This comment has been minimized.
SonarCloud Quality Gate failed. |
Merging this for now. We can improve on the readability of the stack traces later. |
Until now, we have only been rendering the component stack, when the
<ErrorBoundary>
catches an error.This update includes the error stack as well which makes it a lot easier to pinpoint where an error occurred at first glance without having to look in the console.
Note
The component stack can be made more precise by wrapping each module in an
<ErrorBoundary>
.Before
After