From 229b6121d2f9e2146c2f401db8a896146754eb40 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 10 Jan 2026 20:20:40 +0000 Subject: [PATCH] feat(ux): add error handling for image loading Adds an `onerror` handler to the poster image loading logic. If the image fails to load after the API call succeeds, this change hides the loading overlay and shows an error toast to the user. This prevents the UI from getting stuck in an infinite loading state, providing crucial feedback and improving the overall user experience. --- web_app/static/script.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web_app/static/script.js b/web_app/static/script.js index 441a4ed..229021e 100644 --- a/web_app/static/script.js +++ b/web_app/static/script.js @@ -671,6 +671,10 @@ async function generatePoster() { showDownloadButton(imageUrl, data.filename); loadingOverlay.style.display = 'none'; }; + img.onerror = () => { + loadingOverlay.style.display = 'none'; + showToast("Error: Failed to load the generated poster image.", "error"); + }; } catch (error) { console.error("Generation failed", error);