-
Notifications
You must be signed in to change notification settings - Fork 16
fix: raise original error on download attachment #592
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: main
Are you sure you want to change the base?
Conversation
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 error handling in the attachments service by properly catching and re-raising the original EnrichedException instead of wrapping it in a generic Exception. The change ensures that specific error details and status codes are preserved when attachment download operations fail.
- Replaces generic Exception handling with specific EnrichedException handling
- Uses structured status code checking instead of string parsing for 404 errors
- Preserves original exception details by re-raising the caught EnrichedException directly
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/uipath/_services/attachments_service.py | Updated exception handling in both sync and async download methods to catch EnrichedException specifically and preserve original error details |
pyproject.toml | Version bump from 2.1.51 to 2.1.52 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
except EnrichedException as e: | ||
# If not found in UiPath, check local storage | ||
if "404" in str(e): | ||
if e.status_code == 404: |
Copilot
AI
Sep 17, 2025
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.
The code assumes EnrichedException has a status_code attribute, but this may not always be the case. Consider adding a safety check like getattr(e, 'status_code', None) == 404
to prevent AttributeError if the exception doesn't have this attribute.
if e.status_code == 404: | |
if getattr(e, 'status_code', None) == 404: |
Copilot uses AI. Check for mistakes.
except EnrichedException as e: | ||
# If not found in UiPath, check local storage | ||
if "404" in str(e): | ||
if e.status_code == 404: |
Copilot
AI
Sep 17, 2025
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.
Same issue as in the sync version - the code assumes EnrichedException has a status_code attribute without checking. Consider adding a safety check like getattr(e, 'status_code', None) == 404
to prevent AttributeError.
if e.status_code == 404: | |
if getattr(e, 'status_code', None) == 404: |
Copilot uses AI. Check for mistakes.
Development Package