Skip to content

Conversation

@julien-lang
Copy link
Member

AttributeError: 'Exception' object has no attribute 'message'

AttributeError: 'Exception' object has no attribute 'message'
@julien-lang julien-lang requested a review from Copilot November 25, 2025 01:14
Copy link

Copilot AI left a 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 message attribute
  • Implemented fallback chain: messageargs[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>
@julien-lang julien-lang marked this pull request as ready for review November 25, 2025 01:16
@julien-lang julien-lang requested a review from a team November 25, 2025 01:16
@julien-lang
Copy link
Member Author

Regression Fix

QA was correct - the original PR only fixed 1 out of 5 occurrences of e.message in the codebase.

Found and fixed 4 additional occurrences:

  • server_protocol.py:179 - JSON decoding error handling
  • api_v1.py:91 - open() method error handling
  • api_v1.py:145 - executeToolkitCommand() error handling
  • process_manager.py:226 - toolkit command execution error handling

All now use the same fallback pattern: hasattr(e, "message") → e.args[0] → "unknown error"

@julien-lang
Copy link
Member Author

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
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.06%. Comparing base (4398a5a) to head (a8152d3).
⚠️ Report is 66 commits behind head on master.

Files with missing lines Patch % Lines
...ython/tk_framework_desktopserver/shotgun/api_v1.py 0.00% 10 Missing ⚠️
...thon/tk_framework_desktopserver/process_manager.py 0.00% 6 Missing ⚠️
...thon/tk_framework_desktopserver/server_protocol.py 0.00% 5 Missing ⚠️
...ython/tk_framework_desktopserver/shotgun/api_v2.py 0.00% 5 Missing ⚠️
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     
Flag Coverage Δ
Linux 46.91% <0.00%> (?)
Python-3.10 65.06% <0.00%> (?)
Python-3.11 65.06% <0.00%> (?)
Python-3.9 65.02% <0.00%> (?)
Windows 63.05% <0.00%> (?)
macOS 63.58% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants