Class: MsRestAzure::AzureOperationError
- Inherits:
-
MsRest::HttpOperationError
- Object
- MsRest::HttpOperationError
- MsRestAzure::AzureOperationError
- Defined in:
- lib/ms_rest_azure/azure_operation_error.rb
Overview
Class which represents an Azure error.
Instance Attribute Summary collapse
-
#error_code ⇒ String
The error code.
-
#error_message ⇒ String
The error message.
Instance Method Summary collapse
-
#initialize(*args) ⇒ AzureOperationError
constructor
Creates and initialize new instance of the AzureOperationError class.
Constructor Details
#initialize(*args) ⇒ AzureOperationError
Creates and initialize new instance of the AzureOperationError class.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ms_rest_azure/azure_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 |
Instance Attribute Details
#error_code ⇒ String
Returns the error code.
15 16 17 |
# File 'lib/ms_rest_azure/azure_operation_error.rb', line 15 def error_code @error_code end |
#error_message ⇒ String
Returns the error message.
12 13 14 |
# File 'lib/ms_rest_azure/azure_operation_error.rb', line 12 def @error_message end |