Skip to content

Fix: Use FileNotFoundError for file not found in main.py #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

creepereye1204
Copy link

Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors.

Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors.
Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors.
Remove the quote_mode parameter from the unset_key function in main.py.
This parameter was identified as unused within the function body and has been removed to simplify the signature.
@creepereye1204
Copy link
Author

creepereye1204 commented Apr 24, 2025

Title: Refactor: Improve error handling and remove unused parameter in main.py

Description:

This pull request introduces two refactoring changes to main.py aimed at improving code clarity and maintainability.

  1. Use Specific Exception for File Not Found:
    The code previously raised a general IOError when a file was not found. This has been updated to raise the more specific FileNotFoundError. This change provides clearer error information to callers and allows for more precise error handling.

    Before (approx. line 319):

    if raise_error_if_not_found:
        raise IOError("File not found")
    return ""

    After:

    if raise_error_if_not_found:
        raise FileNotFoundError("File not found")
    return ""

creepereye1204 and others added 2 commits April 24, 2025 09:50
Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors.
Fix: Use FileNotFoundError for file not found in main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant