 	addFolderWithProject: (project, parentFolder_id, folderName, callback = (err, folder, parentFolder_id)->) ->
 		# check if folder name is allowed
 		if not SafePath.isCleanFilename folderName
-			return callback new Error("invalid element name")
+			return callback new Errors.InvalidNameError("invalid element name")
 		confirmFolder project, parentFolder_id, (parentFolder_id)=>
 			folder = new Folder name: folderName
 			logger.log project: project._id, parentFolder_id:parentFolder_id, folderName:folderName, "adding new folder"

	_addDocWithProject: (project, folder_id, docName, docLines, userId, callback = (error, doc, folder_id, path) ->)=>
		# check if docname is allowed
		if not SafePath.isCleanFilename docName
			return callback new Error("invalid element name")
		project_id = project._id
		logger.log project_id: project_id, folder_id: folder_id, doc_name: docName, "adding doc to project with project"
		confirmFolder project, folder_id, (folder_id)=>

	restoreDoc: (project_id, doc_id, name, callback = (error, doc, folder_id) ->) ->
		# check if docname is allowed (passed in from client so we check it)
		if not SafePath.isCleanFilename name
			return callback new Errors.InvalidNameError("invalid element name")
		# getDoc will return the deleted doc's lines, but we don't actually remove
		# the deleted doc, just create a new one from its lines.
		ProjectEntityHandler.getDoc project_id, doc_id, include_deleted: true, (error, lines) ->
