diff options
author | Remy Suen <remy.suen@gmail.com> | 2016-11-19 12:18:05 +0900 |
---|---|---|
committer | Remy Suen <remy.suen@gmail.com> | 2016-11-19 12:18:05 +0900 |
commit | a8428a7c4d92a4e7888a238f1344bc4e43e61fce (patch) | |
tree | 2788ca0f8930be1ffa49478b97f44b206b9c1946 | |
parent | e94e8d11b71c9781d509faa82f57b7d991fc09bd (diff) | |
download | org.eclipse.orion.client-a8428a7c4d92a4e7888a238f1344bc4e43e61fce.zip org.eclipse.orion.client-a8428a7c4d92a4e7888a238f1344bc4e43e61fce.tar.gz org.eclipse.orion.client-a8428a7c4d92a4e7888a238f1344bc4e43e61fce.tar.bz2 |
Bug 507690 - Trying to create a project with the same name as an existing one yields strange error
Instead of simply sending a raw, failed mkdir response back to the
client, send a custom user-friendly message back to the client if the
mkdir error is an EEXIST error.
Change-Id: Ie27cff40bda15fa737829f88c991acc9c11ca004
Signed-off-by: Remy Suen <remy.suen@gmail.com>
-rw-r--r-- | modules/orionode/lib/workspace.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/orionode/lib/workspace.js b/modules/orionode/lib/workspace.js index 60c1cbc..0b83c15 100644 --- a/modules/orionode/lib/workspace.js +++ b/modules/orionode/lib/workspace.js @@ -138,7 +138,11 @@ module.exports = function(options) { // Create a project fs.mkdir(fileUtil.safeFilePath(req.user.workspaceDir, projectName), parseInt('0755', 8), function(error) { if (error) { - api.writeError(400, res, error); + if (error.code === 'EEXIST') { + api.writeError(400, res, "Duplicate project name: " + projectName); + } else { + api.writeError(400, res, error); + } } else { api.write(201, res, null, { Id: projectName, |