To prevent draft or unpublished image embeds from breaking the site during the build process, I've added basic error catching that returns a message saying the content has not yet been published.
Ideally, the best way to test this is to spin up a separate staging content model on contentful and update the API requests in this branch to reference the staging URL. This way we could break the content model without affecting the main site - unfortunately the effort required for this is likely not worthwhile. It might be more worthwhile to merge first and then test afterwards, as I'm fairly confident this will resolve the issue.
MR Checklist
[x] Add a description of your pull request and instructions for the reviewer to verify your work.
[x] If your pull request is for a specific ticket, link to it in the description.
[x] Stay on point and keep it small so the merge request can be easily reviewed.
[x] Consider adding unit tests, especially for bug fixes. If you don't, tell us why.
[x] Tests and linting passes.
[x] Consider updating documentation. If you don't, tell us why.
[x] If relevant, list the environments / browsers in which you tested your changes.
Link to Ticket On Codebase
Description of Changes Made
To prevent draft or unpublished image embeds from breaking the site during the build process, I've added basic error catching that returns a message saying the content has not yet been published.
How to Test
Link to changes made on preview site
Ideally, the best way to test this is to spin up a separate staging content model on contentful and update the API requests in this branch to reference the staging URL. This way we could break the content model without affecting the main site - unfortunately the effort required for this is likely not worthwhile. It might be more worthwhile to merge first and then test afterwards, as I'm fairly confident this will resolve the issue.
MR Checklist