fix(#373): improve error handling when songs fail to play - #477
Conversation
780c286 to
94d22bd
Compare
07d443a to
5c680ef
Compare
- Guard artworks null in discord.ts to prevent crash - Break sync recursion in positionChange - Remove orphaned merge conflict markers from locale JSON files (en, pl) - Verified: format check and lint pass on CI
866bf3e to
3b77b27
Compare
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR adds comprehensive playback error recovery by validating audio files on the backend, automatically advancing to the next song when playback fails, displaying a skip button in error prompts, and resetting error state on song load. Media source errors trigger automatic skip without user interaction. ChangesPlayback Error Recovery with Skip-Forward
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
✅ Action performedReview finished.
|
|
@Sandakan please re-merge when you get a chance. |
Fixes #373
Three failure modes were handled poorly:
Changes
CODE 4 = skip immediately (usePlaybackErrors.tsx): MEDIA_ERR_SRC_NOT_SUPPORTED is not retryable. The error handler now calls skipSongRef() directly without counting or retrying.
CODE 3 retry limit (usePlaybackErrors.tsx): Fixed >= 5 (was > 5), so the max retries is exactly 5.
File existence pre-check (sendAudioData.ts): After resolving the file path with removeDefaultAppProtocolFromFilePath, we now call existsSync and throw SONG_NOT_FOUND before the request reaches the renderer.
getSong try/catch (player.ts): The fetch in getSong is now wrapped. On failure it emits loadError via EventEmitter so the playback system knows the song could not be loaded.
Auto-advance on load failure (player.ts): The positionChange handler catches load rejects and calls moveToNext() bounded by queue length.
Skip button in error prompt (ErrorPrompt.tsx): Added onSkipSong prop. When the user clicks Skip to next song, it invokes skipForwardRef to bypass the broken track.
404 logging (handleFileProtocol.ts): logger.warn now logs when requested files return 404, with both the URL and resolved file path.
Verification
Summary by CodeRabbit
New Features
Bug Fixes