Exception: Bing::BadGateway
- Inherits:
-
ServiceError
- Object
- StandardError
- ServiceError
- Bing::BadGateway
- Defined in:
- lib/bing/errors.rb
Overview
Raised when we get an invalid response from an underlying server
Instance Attribute Summary collapse
-
#code ⇒ Object
Status code from underlying server.
-
#text ⇒ Object
Text we were unable to parse.
-
#uri ⇒ Object
URI for this request.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#code ⇒ Object
Status code from underlying server
39 40 41 |
# File 'lib/bing/errors.rb', line 39 def code @code end |
#text ⇒ Object
Text we were unable to parse
44 45 46 |
# File 'lib/bing/errors.rb', line 44 def text @text 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, =nil = " with message #{}" if error = new "#{uri} returned #{code}#{}" 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
#status ⇒ Object
51 |
# File 'lib/bing/errors.rb', line 51 def status() 502 end |