# File lib/chef_zero/rest_base.rb, line 89 def create_data(request, rest_path, name, data, *options) rest_path ||= request.rest_path begin data_store.create(rest_path, name, data, *options) rescue DataStore::DataNotFoundError raise RestErrorResponse.new(404, "Parent not found: #{build_uri(request.base_uri, request.rest_path)}") rescue DataStore::DataAlreadyExistsError raise RestErrorResponse.new(409, "Object already exists: #{build_uri(request.base_uri, request.rest_path + [name])}") end end