Give correct feedback if an app cannot be found in the appstore

This commit is contained in:
Johannes Zellner
2015-11-13 10:35:29 +01:00
parent d9bfcc7c8a
commit 3d80821203
2 changed files with 2 additions and 0 deletions

View File

@@ -293,6 +293,7 @@ function purchase(appStoreId, callback) {
superagent.post(url).query({ token: config.token() }).end(function (error, res) {
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
if (res.status === 402) return callback(new AppsError(AppsError.BILLING_REQUIRED));
if (res.status === 404) return callback(new AppsError(AppsError.NOT_FOUND));
if (res.status !== 201 && res.status !== 200) return callback(new Error(util.format('App purchase failed. %s %j', res.status, res.body)));
callback(null);