Skip to content

Issue 2: Redundant Error Handling in Rulings and Cards Loading #46

@PrinceSajjadHussain

Description

@PrinceSajjadHussain

Title: Refactor: Remove Redundant nested Try/Except Blocks for File Loading

Body:
The code uses nested try...except UnicodeDecodeError blocks when loading both the rulings file and individual card set files. This is redundant. While handling UnicodeDecodeError is a good practice, nesting these blocks makes the code harder to read and maintain. It also makes it difficult to distinguish between errors arising from the file open operation vs the json.load.

Recommendation:
Refactor the error handling. Remove the inner try block, and let any other exceptions propagate to the outer except Exception as e block. Make sure to log specifically what part of the loading is failing by printing either "rulings_data" or "data" or "cards.json"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions