Fix various error handling

* appstore never returns 403
* change billing_required to plan_limit
This commit is contained in:
Girish Ramakrishnan
2019-05-06 15:00:22 -07:00
parent 7bb6016f7b
commit ffe0e6dbbe
7 changed files with 32 additions and 32 deletions

View File

@@ -27,8 +27,7 @@ function feedback(req, res, next) {
if (req.body.appId && typeof req.body.appId !== 'string') return next(new HttpError(400, 'appId must be string'));
appstore.sendFeedback(_.extend({ }, req.body, { email: req.user.email, displayName: req.user.displayName }), function (error) {
if (error && error.reason === AppstoreError.BILLING_REQUIRED) return next(new HttpError(402, 'Login to App Store to create support tickets. You can also email support@cloudron.io'));
if (error) return next(new HttpError(503, 'Error contacting cloudron.io. Please email support@cloudron.io'));
if (error) return next(new HttpError(503, `Error contacting cloudron.io: ${error.message}. Please email support@cloudron.io`));
next(new HttpSuccess(201, {}));
});