-
Notifications
You must be signed in to change notification settings - Fork 9
SG-41264 Fixup exception instance don't all have a message attribute #306
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
base: master
Are you sure you want to change the base?
Conversation
AttributeError: 'Exception' object has no attribute 'message'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an AttributeError that occurs when exception instances don't have a message attribute. The fix adds proper fallback handling when reporting errors, checking for the message attribute first, then falling back to args[0], and finally using a generic error message.
Key changes:
- Added conditional checks to handle exceptions without a
messageattribute - Implemented fallback chain:
message→args[0]→ "unknown error"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Regression FixQA was correct - the original PR only fixed 1 out of 5 occurrences of e.message in the codebase. Found and fixed 4 additional occurrences:
All now use the same fallback pattern: hasattr(e, "message") → e.args[0] → "unknown error" |
|
Regression fix: Found and fixed 4 additional e.message occurrences in server_protocol.py:179, api_v1.py:91, api_v1.py:145, and process_manager.py:226. All now use proper fallback handling. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #306 +/- ##
===========================================
+ Coverage 41.02% 65.06% +24.03%
===========================================
Files 284 24 -260
Lines 43483 1892 -41591
===========================================
- Hits 17840 1231 -16609
+ Misses 25643 661 -24982
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a8152d3 to
82c2c56
Compare
AttributeError: 'Exception' object has no attribute 'message'