Better error handling of unpurchase errors

This commit is contained in:
Girish Ramakrishnan
2017-02-08 18:39:29 -08:00
parent 10ad1028ae
commit 9692aa3c08
3 changed files with 6 additions and 0 deletions

View File

@@ -249,6 +249,7 @@ function uninstallApp(req, res, next) {
debug('Uninstalling app id:%s', req.params.id);
apps.uninstall(req.params.id, auditSource(req), function (error) {
if (error && error.reason === AppsError.BILLING_REQUIRED) return next(new HttpError(402, 'Billing required'));
if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, 'No such app'));
if (error) return next(new HttpError(500, error));