content-modelling/Handle incorrect content IDs found in embeds #3172
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://trello.com/c/S4xH4K03/878-debug-logging-and-error-handling-for-embed-codes
Previously, if an editor published an Edition with an embed code with an incorrect or missing content ID, then it would fail silently (on Mainstream) or show generic error page (on Whitehall). It seemed like the error for Mainstream wasn't propagating (possibly because it was being called in a Worker, so the Sidekiq job was just failing and retrying in background?).
This is a first pass at handling when we might have an incorrect Content ID, allowing the Edition to be published and the incorrect embed code rendered in plain text in the process, but also alerting Sentry so it will be easier to catch if this issue occurs.
The error handling was introduced last year here, before we started embedded Content Blocks in earnest and I think only Contacts were the embedded content being used?
Is it better to allow the Editor to publish an incorrect block, when they can see that it's not being rendered and correct it, instead of either failing in the background or throwing an error preventing publication? I'm not sure without touching more of the Mainstream architecture how we would throw a more helpful error....
Still TODO:
This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.
Follow these steps if you are doing a Rails upgrade.