diff --git a/README.md b/README.md index 446b3dc..941d54c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/druid_config.rb b/lib/druid_config.rb index dcd9645..57ea992 100644 --- a/lib/druid_config.rb +++ b/lib/druid_config.rb @@ -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 diff --git a/lib/druid_config/exceptions.rb b/lib/druid_config/exceptions.rb index d4ea924..b5326a1 100644 --- a/lib/druid_config/exceptions.rb +++ b/lib/druid_config/exceptions.rb @@ -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 diff --git a/lib/druid_config/util.rb b/lib/druid_config/util.rb index a8e3f80..000471e 100644 --- a/lib/druid_config/util.rb +++ b/lib/druid_config/util.rb @@ -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