зеркало из https://github.com/microsoft/TACO.git
Adding missing rejection if npm fails
This commit is contained in:
Родитель
53c5593828
Коммит
f990f195e1
|
@ -661,24 +661,20 @@ class Kit extends commands.TacoCommandBase {
|
|||
* Validates whether the version string passed is a valid Cordova version
|
||||
*/
|
||||
private static validateCliVersion(version: string): Q.Promise<any> {
|
||||
var deferred: Q.Deferred<any> = Q.defer<any>();
|
||||
|
||||
if (!semver.valid(version)) {
|
||||
return Q.reject(errorHelper.get(TacoErrorCodes.ErrorInvalidVersion, version, "cordova"));
|
||||
}
|
||||
|
||||
CordovaHelper.ensureCordovaVersionAcceptable(version);
|
||||
|
||||
NpmHelper.view("cordova", ["versions"])
|
||||
return NpmHelper.view("cordova", ["versions"])
|
||||
.then(function(versions: string[]) {
|
||||
if (versions.indexOf(version) !== -1) {
|
||||
deferred.resolve(version);
|
||||
return version;
|
||||
} else {
|
||||
deferred.reject(errorHelper.get(TacoErrorCodes.ErrorInvalidVersion, version, "cordova"));
|
||||
throw errorHelper.get(TacoErrorCodes.ErrorInvalidVersion, version, "cordova");
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,6 +49,8 @@ module TacoUtility {
|
|||
npmProcess.on("exit", (code: number, signal: string) => {
|
||||
if (code === 0) {
|
||||
deferred.resolve([stdout, stderr]);
|
||||
} else {
|
||||
deferred.reject(code);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче