Stop showing the component stack in case of an error, and show a more…#4526
Conversation
| {this.props.message} | ||
| {errorString ? ` (${errorString})` : null}.{' '} | ||
| {this.props.reportExplanationMessage} |
There was a problem hiding this comment.
@flodolo
I know that the localization isn't perfect, because we concatenate strings instead of providing them in their entirety. The reason is that I didn't want to spend too much time on it, and I thought that because this is an error component that the users shouldn't see much that would be good enough. I hope that's good enough for you!
There was a problem hiding this comment.
Can you help me understand where the Error: part come from?
I'm really not a fan of having it added as part of the first sentence. Can we keep using Details--error-boundary-message, and insert (concatenate) a fully-formed separate sentence Error: foo. instead? Or maybe put that at the very end, between the localized paragraph and the button?
There was a problem hiding this comment.
This comes from calling toString on the error object. I this case the error object was a new Error("foo") but usually it's an Error with more context (hopefully).
There was a problem hiding this comment.
I agree with @flodolo's comment. I don't think we need to change the Details--error-boundary-message string here. We can separate the message and error itself to 2 different lines/paragraphs (without putting the error in a paranthesis). I think it's also easier to read for the users in case the error message is very long.
| id="Root--error-boundary-message" | ||
| attrs={{ message: true }} | ||
| > | ||
| <LocalizedErrorBoundary message="Uh oh, some error happened in profiler.firefox.com"> |
There was a problem hiding this comment.
Here I added another one so that the non localized version would be only for errors in AppLocalizationProvider.
| }); | ||
| }); | ||
|
|
||
| describe('app/LocalizedErrorBoundary', function () { |
There was a problem hiding this comment.
I just added a small test for this new component.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #4526 +/- ##
==========================================
- Coverage 88.63% 88.48% -0.15%
==========================================
Files 293 287 -6
Lines 25983 25803 -180
Branches 7000 6940 -60
==========================================
- Hits 23029 22832 -197
- Misses 2748 2765 +17
Partials 206 206
... and 20 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
| type="button" | ||
| onClick={this._toggleErrorDetails} | ||
| aria-expanded={showDetails ? 'true' : 'false'} | ||
| href="https://github.com/firefox-devtools/profiler/issues/new?title=An%20error%20occurred%20in%20Firefox%20Profiler" |
There was a problem hiding this comment.
I think we can even populate the content of the bug to include the error message etc. But we can do that later.
| Details--error-boundary-message2 = | ||
| .message = Uh oh, some unknown error happened in this panel |
There was a problem hiding this comment.
I think we can leave this message as is, with the dot at the end if we move the error to a line below.
| {this.props.message} | ||
| {errorString ? ` (${errorString})` : null}.{' '} | ||
| {this.props.reportExplanationMessage} |
There was a problem hiding this comment.
I agree with @flodolo's comment. I don't think we need to change the Details--error-boundary-message string here. We can separate the message and error itself to 2 different lines/paragraphs (without putting the error in a paranthesis). I think it's also easier to read for the users in case the error message is very long.
582403c to
91259a4
Compare
| display: flex; | ||
| align-items: center; | ||
|
|
There was a problem hiding this comment.
I looked closely at our example page, and I think that this wasn't useful after all, and this was in the way when I tried to add more than 1 child inside this element. So I removed them. But we will need to take care at regressions in some of our notification bars.
| width: 100%; | ||
| max-width: 600px; | ||
| max-height: calc(100%); | ||
| max-width: 800px; |
There was a problem hiding this comment.
I gave some more space to the notice.
| max-width: 600px; | ||
| max-height: calc(100%); | ||
| max-width: 800px; | ||
| max-height: 100%; |
There was a problem hiding this comment.
and remove the calc which didn't seem useful (?).
| flex: none; | ||
| } | ||
|
|
||
| .appErrorBoundaryDetails { |
There was a problem hiding this comment.
I forgot to remove those in the first version of the patch.
| time for the fade out. */ | ||
| transition: opacity 150ms, visibility 0s 150ms; | ||
| visibility: hidden; | ||
| .appErrorBoundaryInnerText > p { |
There was a problem hiding this comment.
I wanted to use p which is semantically better, but it comes with default margin... One day we'll probably want to include some version (or our version) of normalize.css...
There was a problem hiding this comment.
Yeah, it would be good to have a normalize.css.
| Please report this issue to the developers, including the full | ||
| error as displayed in the Developer Tools’ Web Console. | ||
|
|
||
| # This is used in a call to action button, displayed inside the error box. |
There was a problem hiding this comment.
I added some more comments here as well.
|
oops sorry @flodolo, I missed that your r+ was just given now and I resetted it by mistake :-) |
|
Hey @canova, I added all new changes to a separate commit :-) Please tell me what you think! Because I changed some photon styles, I give you the direct link to the deploy preview for the photon example page: https://deploy-preview-4526--perf-html.netlify.app/photon/. |
| time for the fade out. */ | ||
| transition: opacity 150ms, visibility 0s 150ms; | ||
| visibility: hidden; | ||
| .appErrorBoundaryInnerText > p { |
There was a problem hiding this comment.
Yeah, it would be good to have a normalize.css.

… helpful message
We get too many reports with useless stacks. So now I removed the stack output and instead advise the user to look at the devtools web console. I also provided a button for an easier access to github.
I also made it localized when possible.
The localization isn't perfect, because we concatenate strings instead of providing them in their entirety. The reason is that I didn't want to spend too much time on it, and I thought that because this is an error component that the users shouldn't see much that would be good enough.I think it's better now, thanks for your feedback.