Skip to content

Narrow exception handling and add logging for torchcodec fallback - #43

Closed
tlebryk with Copilot wants to merge 3 commits into
feat/shard-from-audiofrom
copilot/sub-pr-40-again
Closed

Narrow exception handling and add logging for torchcodec fallback#43
tlebryk with Copilot wants to merge 3 commits into
feat/shard-from-audiofrom
copilot/sub-pr-40-again

Conversation

CopilotAI commented Feb 10, 2026

Copy link
Copy Markdown

Addresses review feedback on exception handling when importing torchcodec.decoders.AudioDecoder. The broad Exception catch was silently swallowing unrelated errors (internal bugs, environment issues) and making failures harder to diagnose.

Changes:

  • Catch specific exceptions (ImportError, OSError, RuntimeError) instead of broad Exception
  • Log warning with exception details when falling back to torchaudio-based decoder
try:
fromtorchcodec.decodersimportAudioDecoderexcept (ImportError, OSError, RuntimeError) ase:
logger.warning("Failed to import torchcodec AudioDecoder, falling back to torchaudio: %s", e)
AudioDecoder=CompatAudioDecoder

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

CopilotAIand others added 2 commits February 10, 2026 23:55
Co-authored-by: tlebryk <43556997+tlebryk@users.noreply.github.com>
Co-authored-by: tlebryk <43556997+tlebryk@users.noreply.github.com>
CopilotAI changed the title [WIP] Update audio implementation based on feedbackNarrow exception handling and add logging for torchcodec fallbackFeb 10, 2026
CopilotAI requested a review from tlebrykFebruary 10, 2026 23:57
@tlebryktlebryk closed this Feb 11, 2026
Sign up for freeto 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.

2 participants

@tlebryk