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

Catch errors when modules initialised #3190

Merged
merged 1 commit into from
Jan 18, 2023
Merged

Conversation

andysellick
Copy link
Contributor

@andysellick andysellick commented Jan 16, 2023

What

  • wraps the initialisation of module JavaScript on a page with a try/catch block, so that if an error occurs in one module initialisation continues to the next without aborting and breaking all of the JS that follows

Why

We've had some recent problems where an error in a single bit of JS caused all of the following JS to also fail.

Visual Changes

None.

All credit goes to @AshGDS for thinking of this idea.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3190 January 16, 2023 14:55 Inactive
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3190 January 16, 2023 15:00 Inactive
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3190 January 16, 2023 15:11 Inactive
@andysellick andysellick marked this pull request as ready for review January 16, 2023 15:45
Copy link
Contributor

@AshGDS AshGDS 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 👍 I added a non-blocking comment

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3190 January 18, 2023 09:29 Inactive
- wraps the initialisation of modules on a page with a try/catch block, so that if an error occurs in one module initialisation continues to the next without aborting and breaking all of the JS that follows
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3190 January 18, 2023 09:31 Inactive
@andysellick andysellick merged commit a1828f4 into main Jan 18, 2023
@andysellick andysellick deleted the catch-module-errors branch January 18, 2023 11:20
@JamesCGDS JamesCGDS mentioned this pull request Jan 24, 2023
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