Skip to content

Commit

Permalink
Bump version to 0.4.0 and move DruidApiError to Exception class
Browse files Browse the repository at this point in the history
  • Loading branch information
Angel M de Miguel committed Nov 24, 2015
1 parent cad4136 commit 79dc11e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ Some methods return an instance of an `Entity` class. These entities provide mul

## Exceptions

Sometimes the Gem can't access to Druid API. In this case, the gem automatically will reset the Zookeeper connection and retry the query. If second query fails too, a `DruidApiError` exception will be raised.
### DruidConfig::Exceptions::NotAvailableNodes

This exception will be raised when you try to perform a query to a Druid Coordinator or Overlord but there aren't any node of that type available.

### DruidConfig::Exceptions::DruidApiError

Sometimes the Gem have available nodes, but it can't access to Druid API. In this case, the gem automatically will reset the Zookeeper connection and retry the query. If second query fails too, a `DruidConfig::Exceptions::DruidApiError` exception will be raised.

# Collaborate

Expand Down
5 changes: 0 additions & 5 deletions lib/druid_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@

# Base namespace of the gem
module DruidConfig
#
# Exception class for an error to connect the API
#
class DruidApiError < StandardError; end

# Global client of Druidconfig module
@client = nil

Expand Down
5 changes: 5 additions & 0 deletions lib/druid_config/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ def initialize(service)
super("There aren't any available #{service} node")
end
end

#
# Exception class for an error to connect the API
#
class DruidApiError < StandardError; end
end
end
4 changes: 2 additions & 2 deletions lib/druid_config/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def secure_query
begin
yield
rescue HTTParty::RedirectionTooDeep => e
raise(DruidApiError, e) if @retries > 0
raise(DruidConfig::Exceptions::DruidApiError, e) if @retries > 0
@retries += 1
reset!
retry
rescue Errno::ECONNREFUSED => e
raise(DruidApiError, e) if @retries > 0
raise(DruidConfig::Exceptions::DruidApiError, e) if @retries > 0
@retries += 1
reset!
retry
Expand Down

0 comments on commit 79dc11e

Please sign in to comment.