From e20b3f75e457e0bbbcc79e31545bd4d0a22ec0f5 Mon Sep 17 00:00:00 2001 From: "girish@cloudron.io" Date: Tue, 9 Feb 2016 13:45:28 -0800 Subject: [PATCH] Handle NOT_EMPTY group deletion --- src/routes/groups.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/groups.js b/src/routes/groups.js index 36af9be8f..e6acabb46 100644 --- a/src/routes/groups.js +++ b/src/routes/groups.js @@ -58,6 +58,7 @@ function remove(req, res, next) { groups.remove(req.params.groupId, function (error) { if (error && error.reason === GroupError.NOT_FOUND) return next(new HttpError(404, 'Group not found')); + if (error && error.reason === GroupError.NOT_EMPTY) return next(new HttpError(409, 'Group not empty')); if (error) return next(new HttpError(500, error)); next(new HttpSuccess(204));