Method: Azure::Core::Http::HTTPError#initialize

Defined in:
lib/azure/core/http/http_error.rb

#initialize(http_response) ⇒ HTTPError

Public: Initialize an error

http_response - An Azure::Core::HttpResponse



70
71
72
73
74
75
76
77
78
# File 'lib/azure/core/http/http_error.rb', line 70

def initialize(http_response)
  @http_response = http_response
  @uri = http_response.uri
  @status_code = http_response.status_code
  parse_response
  # Use reason phrase as the description if description is empty
  @description = http_response.reason_phrase if (@description.nil? || @description.empty?) && http_response.reason_phrase
  super("#{type} (#{status_code}): #{description}")
end