Exception: Bing::BadGateway

Inherits:
ServiceError show all
Defined in:
lib/bing/errors.rb

Overview

Raised when we get an invalid response from an underlying server

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Status code from underlying server



39
40
41
# File 'lib/bing/errors.rb', line 39

def code
  @code
end

#textObject

Text we were unable to parse



44
45
46
# File 'lib/bing/errors.rb', line 44

def text
  @text
end

#uriObject

URI for this request



49
50
51
# File 'lib/bing/errors.rb', line 49

def uri
  @uri
end

Class Method Details

.bad_response(code, uri, server_message = nil) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/bing/errors.rb', line 28

def self.bad_response code, uri, server_message=nil
  server_message = " with message #{server_message}" if server_message
  error = new "#{uri} returned #{code}#{server_message}"
  error.code = code
  error.uri = uri
  error
end

.parse_error(text, uri = nil) ⇒ Object



21
22
23
24
25
26
# File 'lib/bing/errors.rb', line 21

def self.parse_error text, uri = nil
  error = new "parse error#{uri ? " from #{uri}" : nil} - #{text.inspect}"
  error.text = text
  error.uri = uri
  error
end

Instance Method Details

#statusObject



51
# File 'lib/bing/errors.rb', line 51

def status() 502 end