Module: RSolr::Error::SolrContext

Included in:
Http
Defined in:
lib/rsolr/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#requestObject

Returns the value of attribute request


5
6
7
# File 'lib/rsolr/error.rb', line 5

def request
  @request
end

#responseObject

Returns the value of attribute response


5
6
7
# File 'lib/rsolr/error.rb', line 5

def response
  @response
end

Instance Method Details

#to_sObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rsolr/error.rb', line 7

def to_s
  m = "#{super.to_s}"
  if response
    m << " - #{response[:status]} #{Http::STATUS_CODES[response[:status].to_i]}"
    details = parse_solr_error_response response[:body]
    m << "\nError: #{details}\n" if details
  end
  p = "\nURI: #{request[:uri].to_s}"
  p << "\nRequest Headers: #{request[:headers].inspect}" if request[:headers]
  p << "\nRequest Data: #{request[:data].inspect}" if request[:data]
  p << "\n"
  p << "\nBacktrace: " + self.backtrace[0..10].join("\n")
  m << p
  m
end