Class: RemoteResource::HTTPError
- Inherits:
-
RemoteResourceError
- Object
- RemoteResource::HTTPError
- Defined in:
- lib/remote_resource/errors.rb
Overview
HTTP errors
Instance Method Summary collapse
- #http_action ⇒ Object
-
#initialize(request, response) ⇒ HTTPError
constructor
A new instance of HTTPError.
- #request_body ⇒ Object
- #request_headers ⇒ Object
- #request_query ⇒ Object
- #request_url ⇒ Object
- #resource_klass ⇒ Object
- #response_body ⇒ Object
- #response_code ⇒ Object
- #response_headers ⇒ Object
-
#return_code ⇒ Object
The return code can contain additional information when response_code=0 see curl.se/libcurl/c/libcurl-errors.html for the full list.
- #to_s ⇒ Object
Constructor Details
#initialize(request, response) ⇒ HTTPError
Returns a new instance of HTTPError.
12 13 14 15 |
# File 'lib/remote_resource/errors.rb', line 12 def initialize(request, response) @request = request @response = response end |
Instance Method Details
#http_action ⇒ Object
21 22 23 |
# File 'lib/remote_resource/errors.rb', line 21 def http_action @request.http_action end |
#request_body ⇒ Object
33 34 35 |
# File 'lib/remote_resource/errors.rb', line 33 def request_body @request.body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params end |
#request_headers ⇒ Object
37 38 39 |
# File 'lib/remote_resource/errors.rb', line 37 def request_headers @request.headers end |
#request_query ⇒ Object
29 30 31 |
# File 'lib/remote_resource/errors.rb', line 29 def request_query @request.query end |
#request_url ⇒ Object
25 26 27 |
# File 'lib/remote_resource/errors.rb', line 25 def request_url @request.request_url end |
#resource_klass ⇒ Object
17 18 19 |
# File 'lib/remote_resource/errors.rb', line 17 def resource_klass @request.resource_klass end |
#response_body ⇒ Object
51 52 53 |
# File 'lib/remote_resource/errors.rb', line 51 def response_body @response.body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params end |
#response_code ⇒ Object
41 42 43 |
# File 'lib/remote_resource/errors.rb', line 41 def response_code @response.code end |
#response_headers ⇒ Object
55 56 57 |
# File 'lib/remote_resource/errors.rb', line 55 def response_headers @response.headers end |
#return_code ⇒ Object
The return code can contain additional information when response_code=0 see curl.se/libcurl/c/libcurl-errors.html for the full list
47 48 49 |
# File 'lib/remote_resource/errors.rb', line 47 def return_code @response.return_code end |
#to_s ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/remote_resource/errors.rb', line 59 def to_s = "HTTP request failed for #{resource_klass}" << " with response_code=#{response_code}" if response_code.present? << " with return_code=#{return_code}" if return_code.present? && response_code.zero? << " with http_action=#{http_action}" << " with request_url=#{request_url}" end |