Fix bare except: clauses in Python game scripts - #723
Conversation
|
@Ashvin-KS is attempting to deploy a commit to the Anuj's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR replaces broad except: clauses with more specific exception handling across multiple games, and adds an .editorconfig to standardize formatting rules.
Changes:
- Narrowed exception handlers in Math Quiz, Flappy Game, and Dots & Boxes AI to catch specific exceptions.
- Added
.editorconfigto enforce consistent whitespace, indentation, and newline behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| games/Math-Quiz/Math-Quiz.py | Narrows exception handling for sound playback and score loading |
| games/Flappy-Game/Flappy-Game.py | Narrows exception handling when reading the high score file |
| games/Dots-Boxes-AI/Dots-Boxes-AI.py | Narrows exception handling for AI input parsing / indexing |
| .editorconfig | Adds repo-wide formatting and whitespace rules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| except RuntimeError: | ||
| pass |
| except (FileNotFoundError, json.JSONDecodeError): | ||
| pass |
| except (FileNotFoundError, ValueError): | ||
| high_score = 0 |
| except (IndexError, ValueError): | ||
| print(RED + "❌ Position out of range!" + RESET) | ||
| continue |
|
🎉 Thank you for your contribution! Your Pull Request has been merged successfully. We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone. If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request. Thanks again for your support! 🙌 |
Description
Closes #625
Replaces bare
except:clauses with specific exception types across 3 Python game scripts.Changes
games/Dots-Boxes-AI/Dots-Boxes-AI.py—except (IndexError, ValueError):for out-of-range input handlinggames/Flappy-Game/Flappy-Game.py—except (FileNotFoundError, ValueError):for high score file loadinggames/Math-Quiz/Math-Quiz.py—except RuntimeError:for sound playback;except (FileNotFoundError, json.JSONDecodeError):for score file loading