Exception: 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



37
38
39
# File 'lib/bing/errors.rb', line 37

def code
  @code
end

#textObject

Text we were unable to parse



42
43
44
# File 'lib/bing/errors.rb', line 42

def text
  @text
end

#uriObject

URI for this request



47
48
49
# File 'lib/bing/errors.rb', line 47

def uri
  @uri
end

Class Method Details

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



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

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



19
20
21
22
23
24
# File 'lib/bing/errors.rb', line 19

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



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

def status() 502 end