🧹 Refactor invalid certificate handling in cadcclient#153
Conversation
- Removed TODO comment about handling invalid certs. - Replaced basic `ValueError` catching and re-raising with clear logging that explains the CANFAR proxy certificate is invalid or expired. - Raised a new `ValueError` with a user-friendly message, preserving the original traceback. Co-authored-by: tjzegmott <20817254+tjzegmott@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR refactors invalid CANFAR certificate handling in cadcclient to replace the TODO with a clearer logged error and chained exception when CADC connection setup fails due to ValueError.
Changes:
- Adds an actionable authorization failure log message for invalid or expired CANFAR certificates.
- Re-raises a clearer
ValueErrorwhile preserving the original exception as context.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Removed TODO comment about handling invalid certs. - Replaced basic `ValueError` catching and re-raising with clear logging that explains the CANFAR proxy certificate is invalid or expired. - Raised a new `ValueError` with a user-friendly message, preserving the original traceback. - Fixed line length issue causing flake8 CI failure. Co-authored-by: tjzegmott <20817254+tjzegmott@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
=======================================
Coverage 65.37% 65.37%
=======================================
Files 15 15
Lines 1389 1389
=======================================
Hits 908 908
Misses 481 481 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🎯 What: Handled invalid certificate exceptions gracefully.
💡 Why: To improve codebase health by resolving a TODO and to give the end-user a clear and actionable error message when their CANFAR proxy certificate is invalid or expired, instead of just a generic traceback.
✅ Verification: Handled code review and ensured tests were not structurally broken. Replaced anti-pattern
sys.exit(1)with a raised Exception for better utility library design.✨ Result: Better maintainability and greatly improved error reporting for
datatrail-cliusers encountering certificate issues.PR created automatically by Jules for task 3626286325252793721 started by @tjzegmott