Skip to content

fix: downgrade redundant logger.error(e) to debug in audio modules#148

Merged
lzsweb merged 3 commits into
mainfrom
dev/issue-1
Jun 18, 2026
Merged

fix: downgrade redundant logger.error(e) to debug in audio modules#148
lzsweb merged 3 commits into
mainfrom
dev/issue-1

Conversation

@lzsweb

@lzsweb lzsweb commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

The SDK's exception handlers were logging exceptions at error level before re-raising, causing duplicate logs in user applications. Following PR #68 discussion, downgrade to debug level across audio/asr, audio/qwen_asr, and audio/tts_v2 modules.

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]

The SDK's exception handlers were logging exceptions at error level
before re-raising, causing duplicate logs in user applications.
Following PR #68 discussion, downgrade to debug level across
audio/asr, audio/qwen_asr, and audio/tts_v2 modules.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@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 downgrades several exception logging statements from error to debug level across various audio-related services. The review feedback points out two critical issues: first, several of these services perform synchronous HTTP requests using the requests library under the hood, meaning they should catch requests-specific exceptions rather than asyncio or aiohttp exceptions to ensure retry logic is not bypassed; second, in the files where exceptions are re-raised, a bare raise should be used instead of raise e to preserve the original traceback, and exc_info=True should be passed to logger.debug to properly capture the traceback in the logs.

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/audio/asr/transcription.py Outdated
Comment thread dashscope/audio/asr/transcription.py Outdated
Comment thread dashscope/audio/asr/vocabulary.py Outdated
Comment thread dashscope/audio/qwen_asr/qwen_transcription.py Outdated
Comment thread dashscope/audio/qwen_asr/qwen_transcription.py Outdated
Comment thread dashscope/audio/tts_v2/enrollment.py Outdated
Comment thread dashscope/audio/asr/recognition.py Outdated
Comment thread dashscope/audio/asr/translation_recognizer.py Outdated
zhansheng.lzs and others added 2 commits June 18, 2026 15:16
- Change raise e to bare raise in recognition.py and
  translation_recognizer.py to preserve original tracebacks
- Fix vocabulary.py and enrollment.py catching asyncio/aiohttp
  exceptions despite using sync requests-based BaseApi; switch to
  requests.Timeout and requests.ConnectionError

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
BaseAsyncApi uses sync requests.Session() under the hood (the "Async"
refers to DashScope server-side task polling, not Python async I/O).
Switch from asyncio/aiohttp exceptions to requests.Timeout and
requests.ConnectionError to ensure retry logic actually catches
real network errors.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lzsweb lzsweb merged commit a7edd37 into main Jun 18, 2026
3 checks passed
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