diff --git a/src/routes/subscription.js b/src/routes/subscription.js index 970c833fc..8da8de3a4 100644 --- a/src/routes/subscription.js +++ b/src/routes/subscription.js @@ -20,6 +20,8 @@ function subscribeCloudron(req, res, next) { if (typeof req.body.signup !== 'boolean') return next(new HttpError(400, 'signup must be a boolean')); appstore.subscribeCloudron(req.body, function (error) { + if (error && error.reason === AppstoreError.ALREADY_EXISTS) return next(new HttpError(409, error.message)); + if (error && error.reason === AppstoreError.ACCESS_DENIED) return next(new HttpError(412, error.message)); if (error && error.reason === AppstoreError.EXTERNAL_ERROR) return next(new HttpError(424, error.message)); if (error) return next(new HttpError(500, error)); @@ -31,7 +33,6 @@ function getSubscription(req, res, next) { assert.strictEqual(typeof req.body, 'object'); appstore.getSubscription(function (error, result) { - if (error && error.reason === AppstoreError.ALREADY_EXISTS) return next(new HttpError(409, error.message)); if (error && error.reason === AppstoreError.EXTERNAL_ERROR) return next(new HttpError(424, error.message)); if (error) return next(new HttpError(500, error));