Handle NOT_EMPTY group deletion

This commit is contained in:
girish@cloudron.io
2016-02-09 13:45:28 -08:00
parent 6cca7b3e0e
commit e20b3f75e4

View File

@@ -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));