fix: harden error handling and prevent uncaught async rejections#27
Merged
Conversation
- Add null guards to showError/showSuccess so tests and pre-DOM calls don't throw when message elements are absent - Return early from onload when Supabase is not configured so loadPlayers/loadMatches are never called with empty credentials - Surface ELO revert failures to the user via showError instead of silently logging them - Wrap window.recordMatch/recordDoublesMatch/addPlayer with .catch so unhandled promise rejections from HTML onclick attributes are shown https://claude.ai/code/session_01TgxiTLy7fCh5xZPJT8eTVt
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.
$(cat <<'EOF'
Summary
showError/showSuccess— if the DOM elements are absent (e.g. during tests), errors are routed toconsole.error/console.loginstead of throwingloadPlayers/loadMatchesare no longer called with empty credentials; the error message is shown and the app stops gracefullyshowErroris called in addition toconsole.errorso the user knows to reloadwindow.*async functions wrapped with.catch— HTMLonclickattributes callwindow.recordMatchetc.; unhandled promise rejections are now caught and shown viashowErrorTest plan
npm test)config.jsshows the config error and does not attempt network callshttps://claude.ai/code/session_01TgxiTLy7fCh5xZPJT8eTVt
EOF
)
Generated by Claude Code