Skip to content

Conversation

nickmoreton
Copy link
Contributor

@nickmoreton nickmoreton commented Oct 10, 2025

Code in the pull request is AI generated

This pull request introduces improved error handling for image and document downloads from Bynder.

Error handling improvements:

  • Added new exception classes
  • Updated the download_file function in utils.py to catch HTTP/network errors, check for error pages when expecting images, and raise the appropriate new exceptions.

Model and asset update logic:

  • Modified update_file in models.py to catch download-related exceptions and log warnings, skipping updates if errors occur and ensuring no stale state is left on the asset instance.

Testing and validation:

  • Expanded tests in test_models.py to verify graceful handling of download errors, file-too-large errors, and invalid content, ensuring asset state remains consistent and no exceptions are propagated.

Dependency update:

  • Updated bynder-sdk dependency to allow newer minor versions (<2.1).

@nickmoreton nickmoreton marked this pull request as ready for review October 10, 2025 10:46
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