This ticket adds some basic error handling and the ErrorBoundary wrapper however there are more areas where error handling can be made robust and detailed, particularly for the bulk of the fetchers. As they are not the priority for this ticket that is left for a rainy day.
The idea is to incrementally transition to the more detailed centralized error handling in this ticket as the opportunities arise. IE. Not one large refactor ticket but code quality improvements being baked into existing tickets.
Cypress is suppressing exceptions by default
We're currently (on the dev/main branches) globally suppressing uncaught exceptions during the cypress runtime. Or at least intending to.
As I noted 1. this seems very heavy handed and defeats part of the purpose of having automated tests. 2. Globally suppressing the exceptions doesn't seem to work under all circumstances. A better approach would be to only suppress uncaught exceptions under precise and accounted for circumstances (For example...when exceptions caught by the ErrorBoundary are displayed in the console as "uncaught" in version of React < 19 https://react.dev/blog/2024/04/25/react-19#error-handling. )
(#625) Add pre-render metatag, error handling
GenericErrorPage
triggerServerError
Cypress command to simulate server errors.Updated package dependencies to include
react-error-boundary
.Closes #625
Notes:
Why
react-error-boundary
?An error-boundary follows best practices however the default react ErrorBoundary is lacking in several annoying ways.
The React documentation mentions it as an alternative (https://react.dev/reference/react/Component#componentdidcatch) and it is vetted by the community with over 4million weekly downloads (https://www.npmjs.com/package/react-error-boundary) and key endorsements (https://kentcdodds.com/blog/use-react-error-boundary-to-handle-errors-in-react).
More error handling please.
This ticket adds some basic error handling and the ErrorBoundary wrapper however there are more areas where error handling can be made robust and detailed, particularly for the bulk of the fetchers. As they are not the priority for this ticket that is left for a rainy day.
The idea is to incrementally transition to the more detailed centralized error handling in this ticket as the opportunities arise. IE. Not one large refactor ticket but code quality improvements being baked into existing tickets.
Cypress is suppressing exceptions by default
We're currently (on the dev/main branches) globally suppressing uncaught exceptions during the cypress runtime. Or at least intending to.
As I noted 1. this seems very heavy handed and defeats part of the purpose of having automated tests. 2. Globally suppressing the exceptions doesn't seem to work under all circumstances. A better approach would be to only suppress uncaught exceptions under precise and accounted for circumstances (For example...when exceptions caught by the ErrorBoundary are displayed in the console as "uncaught" in version of React < 19 https://react.dev/blog/2024/04/25/react-19#error-handling. )
Potentially related: https://github.com/cypress-io/cypress/issues/22129