Exception: Druid::DataSource::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/druid/data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



90
91
92
93
94
95
96
97
98
99
# File 'lib/druid/data_source.rb', line 90

def initialize(response)
  @response = response
  parsed_body = MultiJson.load(response.body)
  @error, @error_message, @error_class, @host = parsed_body.values_at(*%w(
    error
    errorMessage
    errorClass
    host
  ))
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



88
89
90
# File 'lib/druid/data_source.rb', line 88

def error
  @error
end

#error_classObject (readonly)

Returns the value of attribute error_class.



88
89
90
# File 'lib/druid/data_source.rb', line 88

def error_class
  @error_class
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



88
89
90
# File 'lib/druid/data_source.rb', line 88

def error_message
  @error_message
end

#hostObject (readonly)

Returns the value of attribute host.



88
89
90
# File 'lib/druid/data_source.rb', line 88

def host
  @host
end

#responseObject (readonly)

Returns the value of attribute response.



88
89
90
# File 'lib/druid/data_source.rb', line 88

def response
  @response
end

Instance Method Details

#messageObject



101
102
103
# File 'lib/druid/data_source.rb', line 101

def message
  error
end

#query_cancelled?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/druid/data_source.rb', line 113

def query_cancelled?
  error == 'Query cancelled'.freeze
end

#query_interrupted?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/druid/data_source.rb', line 109

def query_interrupted?
  error == 'Query interrupted'.freeze
end

#query_timeout?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/druid/data_source.rb', line 105

def query_timeout?
  error == 'Query timeout'.freeze
end

#resource_limit_exceeded?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/druid/data_source.rb', line 117

def resource_limit_exceeded?
  error == 'Resource limit exceeded'.freeze
end

#unknown_exception?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/druid/data_source.rb', line 121

def unknown_exception?
  error == 'Unknown exception'.freeze
end