Skip to content

Graceful image and document error handling - #42

Closed
nickmoreton wants to merge 5 commits into
torchbox:mainfrom
torchbox-forks:feature/graceful-image-download-failures
Closed

Graceful image and document error handling#42
nickmoreton wants to merge 5 commits into
torchbox:mainfrom
torchbox-forks:feature/graceful-image-download-failures

Conversation

@nickmoreton

@nickmoreton nickmoreton commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

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
@nickmoreton

Copy link
Copy Markdown
Contributor Author

I'm happy for this to be closed in favour of #43

@zerolab zerolab closed this Nov 6, 2025
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.

2 participants