Fix: Prevent Silent Exception Swallowing in Model Loading - #530
Fix: Prevent Silent Exception Swallowing in Model Loading#530priyan17singh wants to merge 4 commits into
Conversation
|
Hi @priyan17singh , thanks for your contribution! Can you fix the conflicts? I'll review the PR after that |
b45d1a6 to
28eda4c
Compare
|
Hi @dpascualhe, thank you for taking the time to review! I've resolved the merge conflicts by rebasing my branch on top of the latest master and keeping the improved exception handling from this PR. The branch is now up to date — feel free to review when you get a chance! |
|
Hi @priyan17singh ! Sorry for the delay, I'm afraid some conflicts have arised again, but the intent of your changes is looking good! Could you resolve the conflicts and let us know? I'll be vigilant to merge then. |
|
Hi @dpascualhe, thanks for the patience — conflicts are resolved now and the branch is up to date with master. One thing worth flagging: Let me know if you'd rather I drop the test file entirely for now, or if the skip-guard approach works for you as is. |
Fixes: #520
Summary
This PR fixes silent exception swallowing in model loading logic by:
assertstatements with explicit exceptionsexcept Exception:blocks🚨 Problem
The current implementation:
assertfor file validation (unsafe in production).except Exception:blocks.This makes debugging difficult and hides real failures.
Changes Made
1. Safer File Validation
2. Improved Exception Handling
3. Optional Dependency Handling
🧪 Tests Added
Added
tests/test_model_loading.pyto validate error handling behavior.✔️ Test Results
What is tested
FileNotFoundError📊 Impact