/usr/lib/ruby/vendor_ruby/ms_rest_azure/azure_operation_error.rb is in ruby-ms-rest-azure 0.6.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
module MsRestAzure
#
# Class which represents an Azure error.
#
class AzureOperationError < MsRest::HttpOperationError
# @return [String] the error message.
attr_accessor :error_message
# @return [String] the error code.
attr_accessor :error_code
#
# Creates and initialize new instance of the AzureOperationError 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.
#
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
end
end
|