Skip to content

Commit

Permalink
Handle 'ECONNREFUSED' gracefully. Re-raise other exceptions after pri…
Browse files Browse the repository at this point in the history
…nting the message
  • Loading branch information
Abhijith committed Jan 13, 2012
1 parent 6ba23b8 commit dc4c728
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/rabbitmq/rabbitmq-alive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ def vhost_alive?
password = config[:password]
vhost = config[:vhost]

resource = RestClient::Resource.new "http://#{host}:#{port}/api/aliveness-test/#{vhost}"
resource.get
begin
resource = RestClient::Resource.new "http://#{host}:#{port}/api/aliveness-test/#{vhost}", username, password
resource.get
rescue Errno::ECONNREFUSED => e
puts e.message
"dead"
rescue Exception => e
puts e.message
raise
end
end

end

0 comments on commit dc4c728

Please sign in to comment.