Exception: MsRest::HttpOperationError
- Defined in:
- lib/ms_rest/http_operation_error.rb
Overview
Class which represents an error meaning that either HTTP request or HTTP response was invalid.
Instance Attribute Summary collapse
-
#body ⇒ String
The HTTP response body.
-
#request ⇒ Net::HTTPRequest
The HTTP request object.
-
#response ⇒ Net::HTTPResponse
The HTTP response object.
Instance Method Summary collapse
-
#initialize(*args) ⇒ HttpOperationError
constructor
Creates and initialize new instance of the HttpOperationException class.
Constructor Details
#initialize(*args) ⇒ HttpOperationError
Creates and initialize new instance of the HttpOperationException class.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ms_rest/http_operation_error.rb', line 26 def initialize(*args) if args.size == 1 # When only message is provided. super(args[0]) elsif args.size == 2 # When only request and response provided, body is nil. @request = args[0] @response = args[1] @body = nil super() elsif args.size == 3 # When request, response and body were provided. @request = args[0] @response = args[1] @body = args[2] super() elsif args.size == 4 # When request, response, body and message were provided. @request = args[0] @response = args[1] @body = args[2] super(args[3]) else fail ArgumentError, 'Invalid number of arguments was provided, valid number: 1, 2, 3 or 4' end end |
Instance Attribute Details
#body ⇒ String
Returns the HTTP response body.
18 19 20 |
# File 'lib/ms_rest/http_operation_error.rb', line 18 def body @body end |
#request ⇒ Net::HTTPRequest
Returns the HTTP request object.
12 13 14 |
# File 'lib/ms_rest/http_operation_error.rb', line 12 def request @request end |
#response ⇒ Net::HTTPResponse
Returns the HTTP response object.
15 16 17 |
# File 'lib/ms_rest/http_operation_error.rb', line 15 def response @response end |