smcclennon / SongID

Music identification Telegram bot
https://t.me/SongIDBot
Apache License 2.0
87 stars 20 forks source link

Fix failed downloads #14

Closed smcclennon closed 1 week ago

smcclennon commented 1 week ago

Summary by Sourcery

Bug Fixes:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This PR improves error handling in the file download functionality by adding proper exception logging. The change captures and logs the specific exception that occurs during file downloads, rather than silently catching all exceptions.

Sequence diagram for improved error handling in file download

sequenceDiagram
    actor User
    participant Bot
    participant Logger
    User->>Bot: Request file download
    Bot->>Bot: Get file
    alt File size within limit
        Bot->>User: Download file
    else File size exceeds limit
        Bot->>User: Send file-size limit error
        Bot->>Logger: Log exception
    end

File-Level Changes

Change Details Files
Enhanced error handling and logging for file download failures
  • Added exception capture variable 'e' in the try-except block
  • Added exception logging using logger.exception()
app/SongIDProcessor.py

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).