Exception: RestClient::RequestFailed
- Defined in:
- lib/vendor/rest-client/lib/rest_client/request_errors.rb
Overview
The request failed, meaning the remote HTTP server returned a code other than success, unauthorized, or redirect.
The exception message attempts to extract the error from the XML, using format returned by Rails: <errors><error>some message</error></errors>
You can get the status code by e.http_code, or see anything about the response via e.response. For example, the entire result body (which is probably an HTML error page) is e.response.body.
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #http_code ⇒ Object
-
#initialize(response = nil) ⇒ RequestFailed
constructor
A new instance of RequestFailed.
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ RequestFailed
Returns a new instance of RequestFailed.
52 53 54 |
# File 'lib/vendor/rest-client/lib/rest_client/request_errors.rb', line 52 def initialize(response=nil) @response = response end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
50 51 52 |
# File 'lib/vendor/rest-client/lib/rest_client/request_errors.rb', line 50 def response @response end |
Instance Method Details
#http_code ⇒ Object
56 57 58 |
# File 'lib/vendor/rest-client/lib/rest_client/request_errors.rb', line 56 def http_code @response.code.to_i if @response end |
#message ⇒ Object
60 61 62 |
# File 'lib/vendor/rest-client/lib/rest_client/request_errors.rb', line 60 def "HTTP status code #{http_code}" end |
#to_s ⇒ Object
64 65 66 |
# File 'lib/vendor/rest-client/lib/rest_client/request_errors.rb', line 64 def to_s end |