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

Adding error boundary above App #475

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Tamir198
Copy link
Contributor

@Tamir198 Tamir198 commented Oct 1, 2023

Changes Proposed

Check List

  • The title of my pull request is a short description of the changes
  • This PR relates to some issue:
  • I have documented the changes made (if applicable)
  • I have covered the changes with unit tests

Added global error boundary

@Tamir198
Copy link
Contributor Author

Tamir198 commented Oct 1, 2023

@nir2002

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (88ea89a) 29.85% compared to head (dbd8175) 29.85%.
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #475   +/-   ##
=======================================
  Coverage   29.85%   29.85%           
=======================================
  Files          10       10           
  Lines        1323     1323           
=======================================
  Hits          395      395           
  Misses        887      887           
  Partials       41       41           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

<React.StrictMode>
<App />
</React.StrictMode>
<ErrorBoundary fallback={<div>Something went wrong</div>}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Showing "Something went wrong" is not enough. We should display some error details, as well as suggestion to reload the page or start from the root of the application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I talked to nir regarding what more to do in this pr, I will have an update later this week

@Tamir198
Copy link
Contributor Author

Tamir198 commented Oct 3, 2023

I added the global error modal component as a fallback for the error boundary.

For testing, I added this line into the App.tsx file right above the render method:

throw { title: "Error", message: "This is message" };

This an error thrown somewhere handled by the error boundary, if this is the case this is what you will see :

image

As you can see, right now I rely on the { title: "Error", message: "This is message" } structure.

@nir2002

Is there any consistent structure that I can use for errors ?

Ps - Once we will have an error structure I will add prop type into the ErrorBoundaryFallback

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