From 2c62acee0bb8082f69c558bb348b3d68406ee104 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 31 Mar 2017 10:31:03 +0100 Subject: [PATCH] Cleaner error reporting for `addFolder` endpoint --- .../app/coffee/Features/Editor/EditorHttpController.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Editor/EditorHttpController.coffee b/services/web/app/coffee/Features/Editor/EditorHttpController.coffee index 0c547e53ba..098d474172 100644 --- a/services/web/app/coffee/Features/Editor/EditorHttpController.coffee +++ b/services/web/app/coffee/Features/Editor/EditorHttpController.coffee @@ -96,8 +96,10 @@ module.exports = EditorHttpController = EditorController.addFolder project_id, parent_folder_id, name, "editor", (error, doc) -> if error == "project_has_to_many_files" res.status(400).json(req.i18n.translate("project_has_to_many_files")) + else if error.message == 'invalid element name' + res.status(400).json(req.i18n.translate('invalid_file_name')) else if error? - next(error) + res.status(500).json(req.i18n.translate('generic_something_went_wrong')) else res.json doc