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 an error boundary #225

Open
jedpittman opened this issue Dec 15, 2020 · 1 comment
Open

Add an error boundary #225

jedpittman opened this issue Dec 15, 2020 · 1 comment
Assignees

Comments

@jedpittman
Copy link
Collaborator

Follow information here to add an error boundary to the application.

https://reactjs.org/docs/error-boundaries.html

Error boundary should include a prompt for the user to reach out to the same contact information and include information that led to the error and the error message from the screen if available.

@jedpittman
Copy link
Collaborator Author

@LewisStaples there are some good resources that you might use for this one based on our conversation.

The top level of the application is here. It is here that you'd want to add the ErrorBoundary...probably at the top level.
https://github.com/codeforboston/jobhopper/blob/develop/frontend/src/Main.tsx

Probably something like this:
const Main = () => ( <React.StrictMode> <Provider store={createStore()}> <MuiThemeProvider theme={theme}> <ErrorBoundary> <BrowserRouter> <App /> </BrowserRouter> </ErrorBoundary> </MuiThemeProvider> </Provider> </React.StrictMode> );

This should work to catch any issues in the application or the browserrouter part of the code (with the standard caveats).

If you are looking for what else besides the messaging should be in that component, you could look to this page for some starting points:
https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/error_boundaries/

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

No branches or pull requests

2 participants