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

Implement error handling in JS #118

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

MKodde
Copy link
Member

@MKodde MKodde commented Apr 10, 2024

The old style of error handling is simulated in this PR

The react app would render an error page whenever an unrecoverable error occurred. The new StimulusJS/SymfonyUX setup was a bit different in this regard. It would just ignore these JS errors and show them in the console. For example, leaving the user 'stranded' when the cancel button was pressed on the webauthn dialog in the browser.

A simplistic approach was chosen to catch the uncaught JS errors. An error listener was registered in the new error_handling.js file. This then displays the pre-rendered error page and fills in the blanks with the error details that are already available as JS variables in the window object.

Only the timestamp and the error message itself are parsed in the error handling routine. Any missing fields are stripped from the error report table.

Finally the retry button was added back.

Comment on lines -1 to -5
{% set translations = {
'authentication.start_button': 'authentication.start_button' | trans,
'registration.start_button': 'registration.start_button' | trans,
'registration.sub_title': 'registration.sub_title' | trans,
'status.registration_initial': 'status.registration_initial' | trans,
Copy link
Member Author

Choose a reason for hiding this comment

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

The no longer used translations (for the old react app) have been removed from the template.

Copy link

@parijke parijke left a comment

Choose a reason for hiding this comment

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

Looks good to me, nice error table include

@MKodde MKodde force-pushed the feature/rejuvenation branch from 5353d1b to 23ff0d1 Compare April 10, 2024 14:51
@MKodde MKodde force-pushed the feature/rejuvination-error-reports branch from 295a56d to b6124f0 Compare April 10, 2024 14:53
@MKodde
Copy link
Member Author

MKodde commented Apr 11, 2024

Thanks for the feedback and your review effort 👯
Merging this into feature/rejuvination after you finished review there!

@phavekes phavekes merged commit cffd5ea into feature/rejuvenation Apr 12, 2024
1 check passed
@phavekes phavekes deleted the feature/rejuvination-error-reports branch April 12, 2024 06:26
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