Added workaround for Cordova-ios now sometimes throwing a string instead of an error as part of 4.0.1 change

This commit is contained in:
Guillaume Jenkins 2016-02-05 17:14:05 -08:00
Родитель b4b021c30f
Коммит 54bf91cb77
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -91,9 +91,17 @@ class Builder {
Logger.log(resources.getString("DoneBuilding", self.currentBuild.buildNumber));
self.currentBuild.updateStatus(BuildInfo.COMPLETE);
})
.catch(function (err: Error): void {
Logger.log(resources.getString("ErrorBuilding", self.currentBuild.buildNumber, err.message));
self.currentBuild.updateStatus(BuildInfo.ERROR, "BuildFailedWithError", err.message);
.catch(function (err: Error | string): void {
var errorMessage: string;
if (typeof err === "string") {
errorMessage = err;
} else {
errorMessage = err.message;
}
Logger.log(resources.getString("ErrorBuilding", self.currentBuild.buildNumber, errorMessage));
self.currentBuild.updateStatus(BuildInfo.ERROR, "BuildFailedWithError", errorMessage);
}).then(function (): BuildInfo {
return self.currentBuild;
});