Handle errors if domain is still used on deletion attempt

This commit is contained in:
Johannes Zellner
2017-11-11 22:02:34 +01:00
parent 53e3626e51
commit de44796b6f
6 changed files with 48 additions and 6 deletions
+1
View File
@@ -77,6 +77,7 @@ function del(req, res, next) {
domains.del(req.params.domain, function (error) {
if (error && error.reason === DomainError.NOT_FOUND) return next(new HttpError(404, error.message));
if (error && error.reason === DomainError.IN_USE) return next(new HttpError(409, 'Domain is still in use'));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(204, {}));