in src/DependencyManagement/DependencySnapshotInstaller.cs [253:282]
private string GetModuleLatestPublishedVersion(string moduleName, string majorVersion)
{
string latestVersion = null;
string errorDetails = null;
bool throwException = false;
try
{
latestVersion = _moduleProvider.GetLatestPublishedModuleVersion(moduleName, majorVersion);
}
catch (Exception e)
{
throwException = true;
if (!string.IsNullOrEmpty(e.Message))
{
errorDetails = string.Format(PowerShellWorkerStrings.ErrorDetails, e.Message);
}
}
// If we could not find the latest module version error out.
if (string.IsNullOrEmpty(latestVersion) || throwException)
{
var errorMsg = string.Format(PowerShellWorkerStrings.FailToGetModuleLatestVersion, moduleName, majorVersion, errorDetails ?? string.Empty);
throw new InvalidOperationException(errorMsg);
}
return latestVersion;
}