Respond correctly when we hit a port conflict on app configure

Fixes #290
This commit is contained in:
Johannes Zellner
2015-03-24 11:51:30 +01:00
parent 3ea11a55ba
commit 3a1ae4e9ec
+2
View File
@@ -144,6 +144,8 @@ function configureApp(req, res, next) {
apps.configure(req.params.id, data.location, data.portBindings, data.accessRestriction, function (error) {
if (error && error.reason === AppsError.ALREADY_EXISTS) return next(new HttpError(409, error.message));
if (error && error.reason === AppsError.PORT_RESERVED) return next(new HttpError(409, 'Port ' + error.message + ' is reserved.'));
if (error && error.reason === AppsError.PORT_CONFLICT) return next(new HttpError(409, 'Port ' + error.message + ' is already in use.'));
if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, 'No such app'));
if (error && error.reason === AppsError.BAD_STATE) return next(new HttpError(409, error.message));
if (error && error.reason === AppsError.BAD_FIELD) return next(new HttpError(400, error.message));