class Haipa::Client::HaipaOperationError
Class which represents an Haipa
error.
Attributes
error_code[RW]
@return [String] the error code.
error_message[RW]
@return [String] the error message.
Public Class Methods
new(*args)
click to toggle source
Creates and initialize new instance of the HaipaOperationError
class. @param [Hash] the HTTP request data (uri, body, headers). @param [Faraday::Response] the HTTP response object. @param [String] body the HTTP response body. @param [String] error message.
Calls superclass method
# File lib/haipa_rest/haipa_operation_error.rb, line 24 def initialize(*args) super(*args) # Try to parse @body to find useful error message and code # Body should meet the error condition response requirements for Microsoft REST API Guidelines # https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#7102-error-condition-responses begin unless @body.nil? @error_message = @body['error']['message'] @error_code = @body['error']['code'] @msg = "#{@msg}: #{@error_code}: #{@error_message}" end rescue end end