Method: Chef::Compliance::Fetcher::ChefServer#with_http_rescue

Defined in:
lib/chef/compliance/fetcher/chef_server.rb

#with_http_rescueObject



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/chef/compliance/fetcher/chef_server.rb', line 83

def with_http_rescue
  response = yield
  if response.respond_to?(:code)
    # handle non 200 error codes, they are not raised as Net::HTTPClientException
    handle_http_error_code(response.code) if response.code.to_i >= 300
  end
  response
rescue Net::HTTPClientException => e
  Chef::Log.error e
  handle_http_error_code(e.response.code)
end