def create_data_dir(request, rest_path, name, *options)
rest_path ||= request.rest_path
begin
data_store.create_dir(rest_path, name, *options, :requestor => request.requestor)
rescue DataStore::DataNotFoundError
if options.include?(:data_store_exceptions)
raise
else
raise RestErrorResponse.new(404, "Parent not found: #{build_uri(request.base_uri, request.rest_path)}")
end
rescue DataStore::DataAlreadyExistsError
if options.include?(:data_store_exceptions)
raise
else
raise RestErrorResponse.new(409, "Object already exists: #{build_uri(request.base_uri, request.rest_path + [name])}")
end
end
end