Skip to content

Fix exception handling in FileClass and improve file I/O reliability#371

Open
AYUSH676-JARVIS wants to merge 3 commits intoEAPD-DRB:mainfrom
AYUSH676-JARVIS:fix-fileclass-exception-handling
Open

Fix exception handling in FileClass and improve file I/O reliability#371
AYUSH676-JARVIS wants to merge 3 commits intoEAPD-DRB:mainfrom
AYUSH676-JARVIS:fix-fileclass-exception-handling

Conversation

@AYUSH676-JARVIS
Copy link
Copy Markdown

Summary:
Fixes incorrect exception handling in FileClass where I/O exceptions were incorrectly re-raised as IndexError.

Enhancements:

  • Refactored file handling using pathlib for cross-platform compatibility
  • Removed incorrect exception remapping and preserved original exceptions
  • Added structured logging for better traceability
  • Implemented atomic file writes to prevent partial writes and data corruption
  • Added directory validation for safer file operations
  • Improved JSON handling using json.load/json.dump
  • Added type hints for better readability and maintainability

Impact:

  • Restores correct Python exception semantics
  • Improves reliability and debuggability of file operations
  • Aligns with modern Python best practices

Closes #357

@github-actions github-actions bot added the needs-intake-fix PR intake structure needs maintainer follow-up label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-intake-fix PR intake structure needs maintainer follow-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Root Problem

1 participant