chore: Handle exceptions on external URL calls (#1334)

This commit is contained in:
Sojan Jose
2020-10-11 20:22:21 +05:30
committed by GitHub
parent 7d409321e9
commit 59bee66e63
6 changed files with 9 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ class Messages::Facebook::MessageBuilder
def attach_file(attachment, file_url)
file_resource = LocalResource.new(file_url)
attachment.file.attach(io: file_resource.file, filename: file_resource.filename, content_type: file_resource.encoding)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
rescue *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "invalid url #{file_url} : #{e.message}"
end