From 018d516b48af11c2c2d376a20cfedbd20ee1f2ec Mon Sep 17 00:00:00 2001 From: danielgrippi <danielgrippi@gmail.com> Date: Sat, 31 Dec 2011 13:47:53 -0500 Subject: [PATCH] rescue pubsubhubbub error if your pod is offline (resolves issue when posting public posts in dev mode with no internet connectivity) --- lib/pubsubhubbub.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/pubsubhubbub.rb b/lib/pubsubhubbub.rb index 2bc4829bd0..f6a9be5e17 100644 --- a/lib/pubsubhubbub.rb +++ b/lib/pubsubhubbub.rb @@ -8,15 +8,16 @@ class Pubsubhubbub def initialize(hub, options={}) @headers = H.merge(options[:head]) if options[:head] - @hub = hub + @hub = hub end def publish(feed) begin - response = RestClient.post(@hub, :headers => @headers, 'hub.url' => feed, 'hub.mode' => 'publish') - return response - 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}" + 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}" + rescue SocketError + Rails.logger.warn "Pod not connected to the internet. Cannot post to pubsub hub!" end end end -- GitLab