kiesraad / abacus

Abacus, software voor verkiezingsuitslagen en zetelverdeling
https://kiesraad-abacus.pages.dev
European Union Public License 1.2
17 stars 6 forks source link

Epic: error handling in frontend #398

Open praseodym opened 1 month ago

marlonbaeten commented 3 weeks ago

Proposed strategy:

We keep this error state global because they represent a state in out global state machine - which in our case is mainly dictated by the router. We want to prevent multiple error states at once.

marlonbaeten commented 3 weeks ago

Discussed with @lkleuver

We introduce an AppStateProvider that holds global state, like the error state but also the currently selected locale.

Recoverable errors are rendered as a modal and do not trigger navigation, unrecoverable errors show a full page message and have their own path.

The "MVP" implementation for unrecoverable errors show a stack trace and full error message. An improvement for this in production is to encode the error information and show a QR code to the user, that allows them to communicate the exact error.

marlonbaeten commented 2 weeks ago

Not that currently we did not introduce any global state apart from fatal errors that are caught and rendered by the ErrorBoundary (using react-router).