private void HandleUpdateCheckErrors(InstallerOperationResult result) { switch (result.Error) { case InstallerErrorCode.InvalidSource: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_Update_Error_InvalidNuGetFeeds, result.TemplatePackage.DisplayName).Bold().Red()); break; case InstallerErrorCode.PackageNotFound: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_Update_Error_PackageNotFound, result.TemplatePackage.DisplayName).Bold().Red()); break; case InstallerErrorCode.UnsupportedRequest: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_Update_Error_PackageNotSupported, result.TemplatePackage.DisplayName).Bold().Red()); break; case InstallerErrorCode.GenericError: default: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_Update_Error_GenericError, result.TemplatePackage.DisplayName, result.ErrorMessage).Bold().Red()); break; } }
private async Task DisplayInstallResultAsync(INewCommandInput commandInput, string packageToInstall, InstallerOperationResult result, CancellationToken cancellationToken) { _ = commandInput ?? throw new ArgumentNullException(nameof(commandInput)); if (string.IsNullOrWhiteSpace(packageToInstall)) { throw new ArgumentException(nameof(packageToInstall)); } _ = result ?? throw new ArgumentNullException(nameof(result)); cancellationToken.ThrowIfCancellationRequested(); if (result.Success) { Reporter.Output.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Info_Success, result.TemplatePackage.DisplayName)); IEnumerable <ITemplateInfo> templates = await result.TemplatePackage.GetTemplates(_engineEnvironmentSettings).ConfigureAwait(false); HelpForTemplateResolution.DisplayTemplateList(templates, _engineEnvironmentSettings, commandInput, _defaultLanguage); } else { switch (result.Error) { case InstallerErrorCode.InvalidSource: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_InvalidNuGetFeeds, packageToInstall, result.ErrorMessage).Bold().Red()); break; case InstallerErrorCode.PackageNotFound: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_PackageNotFound, packageToInstall).Bold().Red()); break; case InstallerErrorCode.DownloadFailed: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_DownloadFailed, packageToInstall).Bold().Red()); break; case InstallerErrorCode.UnsupportedRequest: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_UnsupportedRequest, packageToInstall).Bold().Red()); break; case InstallerErrorCode.AlreadyInstalled: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_AlreadyInstalled, packageToInstall).Bold().Red()); break; case InstallerErrorCode.UpdateUninstallFailed: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_UninstallFailed, packageToInstall).Bold().Red()); break; case InstallerErrorCode.InvalidPackage: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_InvalidPackage, packageToInstall).Bold().Red()); break; case InstallerErrorCode.GenericError: default: Reporter.Error.WriteLine( string.Format( LocalizableStrings.TemplatePackageCoordinator_lnstall_Error_GenericError, packageToInstall).Bold().Red()); break; } } }