From 3a1ae4e9ecc530d2df1e95382a0a1dbd142d5f86 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 24 Mar 2015 11:51:30 +0100 Subject: [PATCH] Respond correctly when we hit a port conflict on app configure Fixes #290 --- src/routes/apps.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/apps.js b/src/routes/apps.js index 8c4cc3f4e..6800c8cd9 100644 --- a/src/routes/apps.js +++ b/src/routes/apps.js @@ -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));