diff --git a/src/apps.js b/src/apps.js index d822b879f..1279542a5 100644 --- a/src/apps.js +++ b/src/apps.js @@ -449,7 +449,7 @@ function downloadManifest(appStoreId, manifest, callback) { superagent.get(url).timeout(30 * 1000).end(function (error, result) { if (error && !error.response) return callback(new AppsError(AppsError.EXTERNAL_ERROR, 'Network error downloading manifest:' + error.message)); - if (result.statusCode !== 200) return callback(new AppsError(AppsError.EXTERNAL_ERROR, util.format('Failed to get app info from store.', result.statusCode, result.text))); + if (result.statusCode !== 200) return callback(new AppsError(AppsError.NOT_FOUND, util.format('Failed to get app info from store.', result.statusCode, result.text))); callback(null, parts[0], result.body.manifest); }); diff --git a/src/routes/apps.js b/src/routes/apps.js index b0e890ece..bac1ccede 100644 --- a/src/routes/apps.js +++ b/src/routes/apps.js @@ -149,6 +149,7 @@ function installApp(req, res, next) { debug('Installing app :%j', data); apps.install(data, auditSource(req), function (error, app) { + if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, error.message)); 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.'));