Skip to content

Stop showing the component stack in case of an error, and show a more…#4526

Merged
julienw merged 3 commits into
firefox-devtools:mainfrom
julienw:stop-output-traces-in-error
Mar 16, 2023
Merged

Stop showing the component stack in case of an error, and show a more…#4526
julienw merged 3 commits into
firefox-devtools:mainfrom
julienw:stop-output-traces-in-error

Conversation

@julienw

@julienw julienw commented Mar 13, 2023

Copy link
Copy Markdown
Contributor

… 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.

image

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.

@julienw julienw requested a review from a team as a code owner March 13, 2023 13:38
Comment thread src/components/app/ErrorBoundary.js Outdated
Comment on lines +79 to +81
{this.props.message}
{errorString ? ` (${errorString})` : null}.{' '}
{this.props.reportExplanationMessage}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@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!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, I think this is indeed better now:

image

Telll me what you think :-)

Comment thread src/components/app/Root.js Outdated
id="Root--error-boundary-message"
attrs={{ message: true }}
>
<LocalizedErrorBoundary message="Uh oh, some error happened in profiler.firefox.com">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here I added another one so that the non localized version would be only for errors in AppLocalizationProvider.

});
});

describe('app/LocalizedErrorBoundary', function () {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just added a small test for this new component.

@julienw julienw requested a review from canova March 13, 2023 13:47
@codecov

codecov Bot commented Mar 13, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.15 ⚠️

Comparison is base (0300bbe) 88.63% compared to head (582403c) 88.48%.

❗ Current head 582403c differs from pull request most recent head 884a6b4. Consider uploading reports for the commit 884a6b4 to get more accurate results

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              
Impacted Files Coverage Δ
src/components/app/Details.js 85.00% <ø> (ø)
src/components/app/Root.js 100.00% <ø> (ø)
src/components/app/ErrorBoundary.js 96.00% <100.00%> (-0.30%) ⬇️

... 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.
📢 Do you have feedback about the report comment? Let us know in this issue.

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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can even populate the content of the bug to include the error message etc. But we can do that later.

Comment thread locales/en-US/app.ftl Outdated
Comment on lines +225 to +226
Details--error-boundary-message2 =
.message = Uh oh, some unknown error happened in this panel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can leave this message as is, with the dot at the end if we move the error to a line below.

Comment thread src/components/app/ErrorBoundary.js Outdated
Comment on lines +79 to +81
{this.props.message}
{errorString ? ` (${errorString})` : null}.{' '}
{this.props.reportExplanationMessage}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@julienw julienw force-pushed the stop-output-traces-in-error branch from 582403c to 91259a4 Compare March 15, 2023 13:58
Comment on lines -49 to -51
display: flex;
align-items: center;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I gave some more space to the notice.

max-width: 600px;
max-height: calc(100%);
max-width: 800px;
max-height: 100%;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

and remove the calc which didn't seem useful (?).

flex: none;
}

.appErrorBoundaryDetails {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, it would be good to have a normalize.css.

Comment thread locales/en-US/app.ftl
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added some more comments here as well.

@julienw julienw requested review from canova and flodolo March 15, 2023 14:09
@julienw

julienw commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

oops sorry @flodolo, I missed that your r+ was just given now and I resetted it by mistake :-)

@flodolo flodolo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@julienw

julienw commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

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/.

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, thanks!

time for the fade out. */
transition: opacity 150ms, visibility 0s 150ms;
visibility: hidden;
.appErrorBoundaryInnerText > p {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, it would be good to have a normalize.css.

@julienw julienw enabled auto-merge (squash) March 16, 2023 10:33
@julienw julienw merged commit f9a5b4e into firefox-devtools:main Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants