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 Error Handling document #34329

Merged
merged 10 commits into from
Feb 25, 2022
Merged

Conversation

amandeepmittal
Copy link
Contributor

This PR adds a new Error Handling section and addresses questions around the React Error Boundaries and error pages in a Next.js app from the issue: https://github.com/vercel/documentation/issues/106

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running yarn lint

@amandeepmittal
Copy link
Contributor Author

@styfle, I've updated the doc as per your suggestions and commits. Please have a look 🙏

I'm also moving this PR from Draft to PR mode

@amandeepmittal amandeepmittal marked this pull request as ready for review February 17, 2022 17:21
@raphaelsaunier
Copy link

I was about to open an issue about using react-error-boundary with Next.js before stumbling upon this PR; hope you won't mind me chiming in. If you believe this should rather be treated in its own separate issue, let me know! 😃

As reported here bvaughn/react-error-boundary#100 by someone else, the Next.js error overlay takes precedence and always shows up even when an error is thrown. I just tried with your proposed ErrorBoundary class component and it behaves in the exact same way; the fallback UI/component is displayed but the error also shows up in the error overlay in development and causes the build to fail when running next build.

In my case I'm rendering content that comes from a dynamic source (headless CMS) and I'd like to add some extra safety if some of the data is missing or incomplete. Error boundaries would've allowed me to handle this in an elegant way.

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

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

Thanks!

@styfle styfle merged commit f32fd48 into vercel:canary Feb 25, 2022
@amandeepmittal amandeepmittal deleted the add-error-handling branch February 25, 2022 16:40
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants