Skip to content

πŸ’‘ [Feature]: Standardizing Exception Handling (Python Code Quality)Β #1249

@DeepeshKafalatiya

Description

@DeepeshKafalatiya

❓ Problem Statement

Across multiple scripts in the repository (such as various game files and math utility scripts), error handling relies on broad except: or except Exception: blocks.

These broad catches swallow unexpected errors (like missing assets, syntax issues in sub-modules, or keyboard interrupts) without printing a proper traceback. This makes debugging incredibly hard for both contributors locally and maintainers reviewing code quality.


πŸš€ Proposed Enhancement

I propose a codebase-wide enhancement to standardize error handling in the main python scripts. Instead of letting execution silently continue or fail with generic warnings, unexpected errors should display clean, informative tracebacks or be caught using narrow, specific exception types (e.g., ValueError, FileNotFoundError).


πŸ› οΈ Suggested Implementation

πŸ”Ή Code Refactoring

  • Target Identification: Scan the games/ and math/ directories for files implementing generic try-except clauses.
  • Specific Exceptions: Replace generic except: statements with localized error checking (e.g., handling specific type mismatches or incorrect user inputs explicitly).
  • Traceback Logging: Incorporate the standard traceback library where essential to ensure deep-rooted execution bugs bubble up explicitly during testing rather than failing silently.

πŸ“‹ Checklist

  • I am a registered GSSoC 2026 contributor.
  • I would like to implement this feature myself.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions