rescue pubsubhubbub error if your pod is offline (resolves issue when posting public posts in dev mode with no internet connectivity)

This commit is contained in:
danielgrippi 2011-12-31 13:47:53 -05:00
parent 5bbfebdba9
commit 018d516b48

View file

@ -13,10 +13,11 @@ class Pubsubhubbub
def publish(feed)
begin
response = RestClient.post(@hub, :headers => @headers, 'hub.url' => feed, 'hub.mode' => 'publish')
return response
return RestClient.post(@hub, :headers => @headers, 'hub.url' => feed, 'hub.mode' => 'publish')
rescue RestClient::BadRequest=> e
Rails.logger.warn "Public URL for your users are incorrect. this is ok if you are in development and localhost is your pod_url#{e.inspect}"
Rails.logger.warn "Public URL for your users are incorrect. (This is ok if you are in development and localhost is your pod_url) #{e.inspect}"
rescue SocketError
Rails.logger.warn "Pod not connected to the internet. Cannot post to pubsub hub!"
end
end
end