Better error for invalid update versions
This commit is contained in:
+2
-3
@@ -207,9 +207,8 @@ async function getBoxUpdate(options) {
|
||||
|
||||
const updateInfo = response.body;
|
||||
|
||||
if (!semver.valid(updateInfo.version) || semver.gt(constants.VERSION, updateInfo.version)) {
|
||||
throw new BoxError(BoxError.EXTERNAL_ERROR, `Update version invalid or is a downgrade: ${response.status} ${response.text}`);
|
||||
}
|
||||
if (!semver.valid(updateInfo.version)) throw new BoxError(BoxError.EXTERNAL_ERROR, `Offered version ${updateInfo.version} is invalid`);
|
||||
if (semver.gt(constants.VERSION, updateInfo.version)) throw new BoxError(BoxError.EXTERNAL_ERROR, `Offered version ${updateInfo.version} would be a downgrade`);
|
||||
|
||||
// updateInfo: { version, changelog, sourceTarballUrl, sourceTarballSigUrl, boxVersionsUrl, boxVersionsSigUrl }
|
||||
if (!updateInfo.version || typeof updateInfo.version !== 'string') throw new BoxError(BoxError.EXTERNAL_ERROR, `Bad response (bad version): ${response.status} ${response.text}`);
|
||||
|
||||
Reference in New Issue
Block a user