fix: prevent UI from hanging on unexpected errors during capture flow#1464
Open
flacoonb wants to merge 2 commits intoPhotoboothProject:devfrom
Open
fix: prevent UI from hanging on unexpected errors during capture flow#1464flacoonb wants to merge 2 commits intoPhotoboothProject:devfrom
flacoonb wants to merge 2 commits intoPhotoboothProject:devfrom
Conversation
Add comprehensive try/catch error handling to all critical paths in the photo capture flow. Previously, only .fail() callbacks had error handling while .done() callbacks and other functions could silently crash, leaving the UI stuck on the loader screen with takingPic=true. Changes: - Wrap errorPic cleanup in try/catch so page reload always fires - Add fallback timeout (5s) if notificationTimeout is NaN - Add try/catch to thrill(), takePic(), callTakePicApi .done(), callTakeVideoApi .done(), processPic success, processVideo success - Add missing timeout (25s) to callTakeVideoApi jQuery post
af9abb0 to
0c09fb6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add comprehensive try/catch error handling to all critical paths in the photo capture flow. Previously, only .fail() callbacks had error handling while .done() callbacks and other functions could silently crash, leaving the UI stuck on the loader screen with takingPic=true.
Changes:
Prerequisites checklist
What is the purpose of this pull request? (put an "x" next to an item)
What changes did you make? (Give an overview)
When
config.dev.reload_on_erroris enabled, the photobooth should automatically reload the page after displaying an error. However, in certain error scenarios the UI would get stuck on the error/loader screen and never reload.Root cause: All critical functions in the capture flow (
thrill(),takePic(),errorPic(),.done()callbacks,processPic,processVideo) execute insidesetTimeoutor jQuery callbacks with notry/catch. If any exception occurs (e.g. fromremoteBuzzerClient,photoboothTools.getTranslation(), or DOM manipulation), the callback silently aborts and the reload logic never fires. ThetakingPicflag staystrue, effectively locking the UI.Fix: Added
try/catchblocks around all critical paths so that:errorPic()always reaches the reload logic, even if cleanup code throwsthrill(),takePic(), or.done()callbacks is caught and routed toerrorPic()for proper error display and reloadcallTakeVideoApinow has a 25s timeout to prevent hanging on unresponsive backendsnotificationTimeoutisNaNAdditionally, the CI workflow triggers were extended to also run on
fix/**andfeature/**branches.Is there anything you'd like reviewers to focus on?
try/catchblocks inerrorPic(): the reload logic is intentionally placed outside the try block so it always executes, even if cleanup fails.catch {}(parameter-less catch) syntax is used where the error object is not needed, to satisfy ESLint's no-unused-vars rule.notificationTimeout || 5000fallback inerrorPic()ensures reload works even if the timeout config is misconfigured.AI used to create this Pull Request?
Yes, Claude Code (claude-sonnet-4-6) was used to assist with: