diff --git a/SuperGrate/Classes/Logger.cs b/SuperGrate/Classes/Logger.cs index 9ff604a..5b0246a 100644 --- a/SuperGrate/Classes/Logger.cs +++ b/SuperGrate/Classes/Logger.cs @@ -115,7 +115,7 @@ public static void Verbose(string Text, bool Raw = false) /// /// The exception to log. /// The text to convey with the exception. - public static void Exception(Exception Exception, string Text) + public static void Exception(Exception Exception, string Text = "") { if (Exception.Message.EndsWith("\r\n")) { @@ -128,10 +128,11 @@ public static void Exception(Exception Exception, string Text) Verbose(Language.Get("Class/Logger/Prefix/Error") + '\r' + Exception.StackTrace); if(Exception.InnerException != null) { - Error(Exception.InnerException.Message); - Verbose(Language.Get("Class/Logger/Prefix/Error") + '\r' + Exception.InnerException.StackTrace); + Logger.Exception(Exception.InnerException); + //Error(Exception.InnerException.Message); + //Verbose(Language.Get("Class/Logger/Prefix/Error") + '\r' + Exception.InnerException.StackTrace); } - Error(Text); + if (Text != "") Error(Text); } /// /// Updates the UI with the new progress info. diff --git a/SuperGrate/Classes/WMI.cs b/SuperGrate/Classes/WMI.cs index ebc28a0..cd2035c 100644 --- a/SuperGrate/Classes/WMI.cs +++ b/SuperGrate/Classes/WMI.cs @@ -78,13 +78,17 @@ public static void HandleWMIException(Exception e, string Host) { if (e.HResult == -2147023174) //RPC server is unavailable. { - throw new Exception(Language.Get("Class/WMI/Log/Failed/ConnectToViaWMI", Host)); + throw new Exception(Language.Get("Class/WMI/Log/Failed/ConnectToViaWMI", Host), e); } if (e.HResult == -2147024891) //Access is denied. { - throw new Exception(Language.Get("Class/WMI/Log/Failed/ConnectToViaWMIAccessDenied", Host)); + throw new Exception(Language.Get("Class/WMI/Log/Failed/ConnectToViaWMIAccessDenied", Host), e); } - throw new Exception(Language.Get("Class/WMI/Log/Failed/QueryWMI", Host)); + if (e.HResult == -2147023838) //WMI service is disabled. + { + throw new Exception(Language.Get("Class/WMI/Log/Failed/WMIServiceDisabled", Host), e); + } + throw new Exception(Language.Get("Class/WMI/Log/Failed/QueryWMI", Host), e); } } } \ No newline at end of file diff --git a/SuperGrate/Localization/en.xml b/SuperGrate/Localization/en.xml index 39182ac..79f04fe 100644 --- a/SuperGrate/Localization/en.xml +++ b/SuperGrate/Localization/en.xml @@ -191,6 +191,7 @@ Failed to query WMI, {0} might have a corrupt WMI installation. Try to run the command "winmgmt.exe /resetrepository" on the target PC to resolve this issue. https://docs.microsoft.com/en-us/windows/win32/wmisdk/winmgmt Failed to connect to {0} via WMI. Make sure the remote PC is online. Failed to connect to {0} via WMI because access was denied. Make sure your user account has administrative access to the remote PC. + Failed to connect to {0} via WMI because the WMI service failed to start.