Return error object instead of false

This commit is contained in:
Girish Ramakrishnan
2017-07-31 11:57:23 -07:00
parent ae54b57ca7
commit bd52068695
2 changed files with 4 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ exports = module.exports = {
checkManifestConstraints: checkManifestConstraints,
updateApps: updateApps,
autoupdateApps: autoupdateApps,
restoreInstalledApps: restoreInstalledApps,
configureInstalledApps: configureInstalledApps,
@@ -995,13 +995,13 @@ function exec(appId, options, callback) {
});
}
function updateApps(updateInfo, auditSource, callback) { // updateInfo is { appId -> { manifest } }
function autoupdateApps(updateInfo, auditSource, callback) { // updateInfo is { appId -> { manifest } }
assert.strictEqual(typeof updateInfo, 'object');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof callback, 'function');
function canAutoupdateApp(app, newManifest) {
if ((semver.major(app.manifest.version) !== 0) && (semver.major(app.manifest.version) !== semver.major(newManifest.version))) return false; // major changes are blocking
if ((semver.major(app.manifest.version) !== 0) && (semver.major(app.manifest.version) !== semver.major(newManifest.version))) return new Error('Major version change'); // major changes are blocking
var newTcpPorts = newManifest.tcpPorts || { };
var oldTcpPorts = app.manifest.tcpPorts || { };