-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Core: Show exception rather than error on react error boundary #8100
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-8087-show-exception.storybook.now.sh |
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 seems correct to me but would be interested in hearing from @Hypnosphi.
If the user code throws we want to do storyThrewException
with a proper error object.
Can you please take a screenshot of an example error in development? Does it contain duplicated stacktrace? |
Not really, see #8087 (comment) |
componentDidCatch({ message, stack }: Error) { | ||
const { showError } = this.props; | ||
componentDidCatch(err: Error) { | ||
const { showException } = this.props; | ||
// message partially duplicates stack, strip it |
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.
Let's actually do it again
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 will wait for @tmeasday 's feedback on this. Apparently it interacts with Chromatic in some way
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.
chromatic can't test pages with errors anyway
#8087 (comment)
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.
Please at least remove the comment if we're not actually stripping anything
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.
@Hypnosphi FYI the issue here was that tools like Chromatic listen to to the storyThrewException
event in order to show the user a stack trace of broken stories. This was reverting a regression where the wrong event was fired in that case.
Would be good to handle the distinction between "user code error" and "react error" somehow though.
Can we distinguish the two types of errors in the |
What's blocking this? |
I don't know how to do this |
Core: Show exception rather than error on react error boundary
Issue: #8087
What I did
(Follow-up to #8097)
Use
showExecption
(story exception) rather thanshowError
(invalid object returned from story function) on React Error Boundary.How to test