fix: handle 404 errors gracefully in avatar download job (#13491)
## Description Fixes `Avatar::AvatarFromUrlJob` logging 404 errors as ERROR when avatars don't exist ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Small logging-only behavior change that doesn’t affect attachment flow or persisted data beyond existing sync-attribute updates. > > **Overview** > Updates `Avatar::AvatarFromUrlJob` error handling to treat `Down::NotFound` (404/missing avatar URL) as a non-error: it now logs an INFO message instead of logging as ERROR. > > Other `Down::Error` failures continue to be logged as ERROR, and the job still runs `update_avatar_sync_attributes` in `ensure`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 675f41041ae3dd4ead6e0dee5f1586dcad9750cd. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This commit is contained in:
committed by
GitHub
parent
656ae41b24
commit
04c456e0a3
@@ -27,7 +27,9 @@ class Avatar::AvatarFromUrlJob < ApplicationJob
|
||||
content_type: avatar_file.content_type
|
||||
)
|
||||
|
||||
rescue Down::NotFound, Down::Error => e
|
||||
rescue Down::NotFound
|
||||
Rails.logger.info "AvatarFromUrlJob: avatar not found at #{avatar_url}"
|
||||
rescue Down::Error => e
|
||||
Rails.logger.error "AvatarFromUrlJob error for #{avatar_url}: #{e.class} - #{e.message}"
|
||||
ensure
|
||||
update_avatar_sync_attributes(avatarable, avatar_url)
|
||||
|
||||
Reference in New Issue
Block a user