diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/follow_remote_account_service.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb index 0e23ed7d2..00285f47a 100644 --- a/app/services/follow_remote_account_service.rb +++ b/app/services/follow_remote_account_service.rb @@ -31,9 +31,12 @@ class FollowRemoteAccountService < BaseService feed = get_feed(account.remote_url) hubs = feed.xpath('//xmlns:link[@rel="hub"]') - if hubs.empty? || hubs.first.attribute('href').nil? || feed.at_xpath('/xmlns:feed/xmlns:author/xmlns:uri').nil? - Rails.logger.debug "Cannot find PuSH hub or author for #{uri}" - return nil + if hubs.empty? || hubs.first.attribute('href').nil? + raise Goldfinger::Error, "No PubSubHubbub hubs found" + end + + if feed.at_xpath('/xmlns:feed/xmlns:author/xmlns:uri').nil? + raise Goldfinger::Error, "No author URI found" end account.uri = feed.at_xpath('/xmlns:feed/xmlns:author/xmlns:uri').content @@ -53,9 +56,6 @@ class FollowRemoteAccountService < BaseService end return account - rescue Goldfinger::Error, HTTP::Error - Rails.logger.debug "Error while fetching data for #{uri}" - nil end private @@ -89,3 +89,9 @@ class FollowRemoteAccountService < BaseService HTTP end end + +class NoAuthorFeedError < StandardError +end + +class NoHubError < StandardError +end |