From 93df57931e0c260c413bd1036492354c0d8375de Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 5 Aug 2022 14:01:44 -0700 Subject: Improve exception messages and minor code clean up --- src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | 4 ++-- .../Bind/BindDatabaseCommand.cs | 4 +--- src/wix/wix/ConsoleMessageListener.cs | 10 ++++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index 67b869e1..45718031 100644 --- a/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs @@ -685,7 +685,7 @@ namespace WixToolset.Core.Burn if (0 == symbols.Count) { - throw new WixException(ErrorMessages.MissingBundleInformation(nameof(T))); + throw new WixException(ErrorMessages.MissingBundleInformation(typeof(T).Name)); } return symbols; @@ -697,7 +697,7 @@ namespace WixToolset.Core.Burn if (1 != symbols.Count) { - throw new WixException(ErrorMessages.MissingBundleInformation(nameof(T))); + throw new WixException(ErrorMessages.MissingBundleInformation(typeof(T).Name)); } return symbols[0]; diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 1589cc7a..ef8dec38 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -98,8 +98,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind private string IntermediateFolder { get; } - private bool SuppressValidation { get; } - public IBindResult Execute() { if (!this.Intermediate.HasLevel(Data.IntermediateLevels.Linked) || !this.Intermediate.HasLevel(Data.IntermediateLevels.Resolved)) @@ -587,7 +585,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind if (1 != symbols.Count) { - throw new WixException(ErrorMessages.MissingBundleInformation(nameof(T))); + throw new WixException($"Expected to find a single symbol of type {typeof(T).Name} but found {symbols.Count}"); } return symbols[0]; diff --git a/src/wix/wix/ConsoleMessageListener.cs b/src/wix/wix/ConsoleMessageListener.cs index ebf1622b..53c73f68 100644 --- a/src/wix/wix/ConsoleMessageListener.cs +++ b/src/wix/wix/ConsoleMessageListener.cs @@ -48,9 +48,15 @@ namespace WixToolset.Tools.Core } } - public void Write(string message) => Console.Out.WriteLine(message); + public void Write(string message) + { + Console.Out.WriteLine(message); + } - public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel) => defaultMessageLevel; + public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel) + { + return defaultMessageLevel; + } private static IList GetFileNames(SourceLineNumber sourceLineNumbers) { -- cgit v1.2.3-55-g6feb