Skip to content

Fix bare except: clauses in Python game scripts - #723

Merged
steam-bell-92 merged 4 commits into
steam-bell-92:mainfrom
Ashvin-KS:fix/bare-except
May 24, 2026
Merged

Fix bare except: clauses in Python game scripts#723
steam-bell-92 merged 4 commits into
steam-bell-92:mainfrom
Ashvin-KS:fix/bare-except

Conversation

@Ashvin-KS

Copy link
Copy Markdown
Contributor

Description

Closes #625

Replaces bare except: clauses with specific exception types across 3 Python game scripts.

Changes

  • games/Dots-Boxes-AI/Dots-Boxes-AI.pyexcept (IndexError, ValueError): for out-of-range input handling
  • games/Flappy-Game/Flappy-Game.pyexcept (FileNotFoundError, ValueError): for high score file loading
  • games/Math-Quiz/Math-Quiz.pyexcept RuntimeError: for sound playback; except (FileNotFoundError, json.JSONDecodeError): for score file loading

Copilot AI review requested due to automatic review settings May 24, 2026 15:15
@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown

@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .editorconfig to 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.

Comment thread games/Math-Quiz/Math-Quiz.py Outdated
Comment on lines 38 to 39
except RuntimeError:
pass
Comment thread games/Math-Quiz/Math-Quiz.py Outdated
Comment on lines 46 to 47
except (FileNotFoundError, json.JSONDecodeError):
pass
Comment thread games/Flappy-Game/Flappy-Game.py Outdated
Comment on lines 54 to 55
except (FileNotFoundError, ValueError):
high_score = 0
Comment thread games/Dots-Boxes-AI/Dots-Boxes-AI.py Outdated
Comment on lines 289 to 291
except (IndexError, ValueError):
print(RED + "❌ Position out of range!" + RESET)
continue
@steam-bell-92 steam-bell-92 added type:bug Something isn't working level:beginner gssoc:approved GSSoC 2026 approving tag mentor:steam-bell-92 labels May 24, 2026
@steam-bell-92
steam-bell-92 merged commit d7a69e8 into steam-bell-92:main May 24, 2026
8 of 9 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 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! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC 2026 approving tag level:beginner type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Fix bare except: clauses in multiple Python scripts

3 participants