Skip to content

refactor(api): remove redundant exception handling in request modules#138

Merged
luk384090-cloud merged 0 commit into
mainfrom
dev/issue
Jun 15, 2026
Merged

refactor(api): remove redundant exception handling in request modules#138
luk384090-cloud merged 0 commit into
mainfrom
dev/issue

Conversation

@luk384090-cloud

Copy link
Copy Markdown
Collaborator

Description

[Describe what this PR does and why]

Related Issue: Fixes #[issue_number] or Relates to #[issue_number]

Security Considerations: [Check if API keys or sensitive credentials are exposed in code/logs]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Model
  • Application
  • Common
  • Documentation
  • Tests
  • CI/CD

Checklist

  • Pre-commit hooks pass
  • Tests pass locally
  • Documentation updated (if needed)
  • Ready for review

Testing

[How to test these changes]

Additional Notes

[Optional: any other context]

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies error handling in both aiohttp_request.py and http_request.py by removing redundant outer try-except blocks that caught, logged, and re-raised exceptions. The review feedback points out several potential AttributeError vulnerabilities across these files where self.data is accessed directly (either by calling payload methods or accessing parameters) without verifying if it is defined or None. Implementing defensive checks in these locations will prevent potential runtime crashes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread dashscope/api_entities/aiohttp_request.py Outdated
Comment thread dashscope/api_entities/aiohttp_request.py
Comment thread dashscope/api_entities/http_request.py Outdated
Comment thread dashscope/api_entities/http_request.py
@luk384090-cloud luk384090-cloud merged commit 7a245df into main Jun 15, 2026
1 check passed
songguocola pushed a commit to songguocola/dashscope-sdk-python that referenced this pull request Jun 16, 2026
Remove orphaned try: that was left after PR dashscope#138 removed the
redundant try/except wrapping in _handle_aio_request.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant