Skip to content
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

Add optional error boundary support #473

Merged
merged 5 commits into from
Jan 11, 2018

Conversation

dustinsoftware
Copy link
Member

I updated a sample so you can see how this works. When specifying an error handler, then errors will be caught during server-render (including those not handled by error boundaries).

Some tests still need to be added, but I wanted to get the discussion started about this approach.

@dustinsoftware dustinsoftware force-pushed the error-boundaries branch 2 times, most recently from b656cc0 to bd1badb Compare November 16, 2017 05:52
@dustinsoftware
Copy link
Member Author

Ok @Daniel15 this is ready for review

@dustinsoftware
Copy link
Member Author

@Daniel15 would you have time to take a look at this PR soon? Are you OK with the overall direction?

Copy link
Member

@Daniel15 Daniel15 left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! In general, this looks pretty good to me.

{
attributes += string.Format(" class=\"{0}\"", ContainerClass);
if (_configuration.ExceptionHandler == null) {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should also allow setting an exception handler per component (eg. as an argument to this method). Hmm.

{
attributes += string.Format(" class=\"{0}\"", ContainerClass);
if (_configuration.ExceptionHandler == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of checking if this is null, what about making it the default handler? That way, _configuration.ExceptionHandler would never be null.

ContainerId
));
}
_configuration.ExceptionHandler(ex);
Copy link
Member

Choose a reason for hiding this comment

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

Might be worth passing ComponentName and ContainerId too.

@dustinsoftware
Copy link
Member Author

Thanks for the review, I'll push an update soon :)

@dustinsoftware dustinsoftware force-pushed the error-boundaries branch 2 times, most recently from b2c4997 to 4ef3074 Compare December 19, 2017 15:56
@dustinsoftware
Copy link
Member Author

@Daniel15 this should be good to go, want to give it another look?

@Daniel15 Daniel15 merged commit f408fa4 into reactjs:master Jan 11, 2018
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.

None yet

2 participants