Skip to content

Commit

Permalink
Handle Mastodon::HostValidationError when pulling remoteable assets (m…
Browse files Browse the repository at this point in the history
…astodon#6782)

This will prevent, for example, `rake mastodon:redownload_avatars` from crashing when an instance is no longer responding to connection attempts, instead silently continuing as expected.
  • Loading branch information
danhunsaker authored and Gargron committed Mar 17, 2018
1 parent 338bff8 commit 4a0a19f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/remotable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Remotable
send("#{attachment_name}_file_name=", basename + extname)

self[attribute_name] = url if has_attribute?(attribute_name)
rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, Paperclip::Errors::NotIdentifiedByImageMagickError, Addressable::URI::InvalidURIError => e
rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, Paperclip::Errors::NotIdentifiedByImageMagickError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError => e
Rails.logger.debug "Error fetching remote #{attachment_name}: #{e}"
nil
end
Expand Down

0 comments on commit 4a0a19f

Please sign in to comment.