about summary refs log tree commit diff
path: root/app/services/fetch_link_card_service.rb
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-10-07 03:39:08 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-10-06 20:39:08 +0200
commit5c8ca024eff76ab10b45df9fd8a95f77ef274d71 (patch)
tree35233f9e1fbc34cc5d942e93bd341fef631c2d8c /app/services/fetch_link_card_service.rb
parentd8b2f89d33580045aa3115a86b2a9709760e595a (diff)
Improve error handling on LinkCrawlWorker (#5250)
* Improve error handling on LinkCrawlWorker

* Ignore TimeoutError and InvalidURIError too
* Record errors to debug log
* Enable dead job queue on LinkCrawlWorker

Since most of acceptable errors were already ignored, only our side issue should go to dead job queue.

* Ignore all http gem errors
Diffstat (limited to 'app/services/fetch_link_card_service.rb')
-rw-r--r--app/services/fetch_link_card_service.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb
index 4acbfae7a..cf3d78683 100644
--- a/app/services/fetch_link_card_service.rb
+++ b/app/services/fetch_link_card_service.rb
@@ -27,7 +27,8 @@ class FetchLinkCardService < BaseService
     end
 
     attach_card if @card&.persisted?
-  rescue HTTP::ConnectionError, OpenSSL::SSL::SSLError
+  rescue HTTP::Error, Addressable::URI::InvalidURIError => e
+    Rails.logger.debug "Error fetching link #{@url}: #{e}"
     nil
   end