diff --git a/Ginger/Ginger/PluginsLib/PluginsIndexPage.xaml.cs b/Ginger/Ginger/PluginsLib/PluginsIndexPage.xaml.cs index f227510d20..96d16fe172 100644 --- a/Ginger/Ginger/PluginsLib/PluginsIndexPage.xaml.cs +++ b/Ginger/Ginger/PluginsLib/PluginsIndexPage.xaml.cs @@ -22,6 +22,7 @@ limitations under the License. using Amdocs.Ginger.CoreNET.PlugInsLib; using Amdocs.Ginger.Repository; using Ginger.UserControls; +using System; using System.Diagnostics; using System.IO; using System.Threading.Tasks; @@ -170,16 +171,25 @@ private void xInstallButonn_Click(object sender, RoutedEventArgs e) } Task.Factory.StartNew(() => { - WorkSpace.Instance.PlugInsManager.InstallPluginPackage(onlinePluginPackage, release); - onlinePluginPackage.Status = "Installed"; - }).ContinueWith((a) => - { - Dispatcher.Invoke(() => + try { - xProcessingImage.Visibility = Visibility.Collapsed; - xInstallButton.ButtonText = "Install"; - xInstalledVersion.Text = onlinePluginPackage.CurrentPackage; - }); + WorkSpace.Instance.PlugInsManager.InstallPluginPackage(onlinePluginPackage, release); + onlinePluginPackage.Status = "Installed"; + } + catch (Exception ex) + { + onlinePluginPackage.Status = "Error in installation,Please check error logs"; + throw; + } + finally + { + Dispatcher.Invoke(() => + { + xProcessingImage.Visibility = Visibility.Collapsed; + xInstallButton.ButtonText = "Install"; + xInstalledVersion.Text = onlinePluginPackage.CurrentPackage; + }); + } }); xInstalledSection.Visibility = Visibility.Visible; diff --git a/Ginger/GingerCoreNET/PlugInsLib/PluginsManager.cs b/Ginger/GingerCoreNET/PlugInsLib/PluginsManager.cs index d13651fc09..22a47aa317 100644 --- a/Ginger/GingerCoreNET/PlugInsLib/PluginsManager.cs +++ b/Ginger/GingerCoreNET/PlugInsLib/PluginsManager.cs @@ -22,6 +22,7 @@ limitations under the License. using Amdocs.Ginger.Common.Repository.PlugInsLib; using Amdocs.Ginger.CoreNET.Drivers.CommunicationProtocol; using Amdocs.Ginger.CoreNET.PlugInsLib; +using log4net.Plugin; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -69,16 +70,24 @@ public class DriverInfo public void AddPluginPackage(string folder) { - // Verify folder exist - if (!System.IO.Directory.Exists(folder)) + try { - throw new Exception("Plugin folder not found: " + folder); - } + // Verify folder exist + if (!System.IO.Directory.Exists(folder)) + { + throw new Exception("Plugin folder not found: " + folder); + } - PluginPackage pluginPackage = new PluginPackage(folder); - pluginPackage.PluginPackageOperations = new PluginPackageOperations(pluginPackage); - pluginPackage.PluginPackageOperations.LoadPluginPackage(folder); - mSolutionRepository.AddRepositoryItem(pluginPackage); + PluginPackage pluginPackage = new PluginPackage(folder); + pluginPackage.PluginPackageOperations = new PluginPackageOperations(pluginPackage); + pluginPackage.PluginPackageOperations.LoadPluginPackage(folder); + mSolutionRepository.AddRepositoryItem(pluginPackage); + } + catch (Exception ex) + { + Reporter.ToLog(eLogLevel.ERROR, "Error occurred while downloading/updating the Ginger Plugins packages", ex); + throw; + } } private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)