about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-09 17:36:27 +0200
committerGitHub <noreply@github.com>2017-09-09 17:36:27 +0200
commit90712d42933efd9978e4bbae82f81a4650aa4d84 (patch)
tree93300daea81cc1843f02a2a3edbbcd8b2a2c5d67 /app/services
parent6867681c7c0b4a5ec48511c013c3f3aa8684bdae (diff)
Fix errors preventing UnsubscribeService from working (#4866)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/unsubscribe_service.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/services/unsubscribe_service.rb b/app/services/unsubscribe_service.rb
index 865f783bc..b99046712 100644
--- a/app/services/unsubscribe_service.rb
+++ b/app/services/unsubscribe_service.rb
@@ -4,16 +4,19 @@ class UnsubscribeService < BaseService
   def call(account)
     return if account.hub_url.blank?
 
-    @account  = account
-    @response = build_request.perform
+    @account = account
 
-    Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success?
+    begin
+      @response = build_request.perform
+
+      Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success?
+    rescue HTTP::Error, OpenSSL::SSL::SSLError => e
+      Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{e}"
+    end
 
     @account.secret = ''
     @account.subscription_expires_at = nil
     @account.save!
-  rescue HTTP::Error, OpenSSL::SSL::SSLError
-    Rails.logger.debug "PuSH subscription request for #{@account.acct} could not be made due to HTTP or SSL error"
   end
 
   private