Method: ChefDK::ServiceExceptionInspectors::HTTP#attempt_error_message_extract

Defined in:
lib/chef-dk/service_exception_inspectors/http.rb

#attempt_error_message_extractObject



74
75
76
77
78
79
80
81
82
83
# File 'lib/chef-dk/service_exception_inspectors/http.rb', line 74

def attempt_error_message_extract
  error_body = FFI_Yajl::Parser.parse(response_body)
  if error_body.respond_to?(:key?) && error_body.key?("error")
    Array(error_body["error"]).join(", ")
  else
    error_body.to_s
  end
rescue
  response_body
end