Improve exception messages and minor code clean up
Rob Mensching committed
Aug 5, 2022 at 14:01 UTC
93df57931e0c260c413bd1036492354c0d8375de
3 files changed
+11
-7
src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+2
-2
@@ -685,7 +685,7 @@ namespace WixToolset.Core.Burn
685
686
if (0 == symbols.Count)
687
{
688
- throw new WixException(ErrorMessages.MissingBundleInformation(nameof(T)));
688
+ throw new WixException(ErrorMessages.MissingBundleInformation(typeof(T).Name));
689
}
690
691
return symbols;
@@ -697,7 +697,7 @@ namespace WixToolset.Core.Burn
697
698
if (1 != symbols.Count)
699
{
700
- throw new WixException(ErrorMessages.MissingBundleInformation(nameof(T)));
700
+ throw new WixException(ErrorMessages.MissingBundleInformation(typeof(T).Name));
701
}
702
703
return symbols[0];
src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+1
-3
@@ -98,8 +98,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
98
99
private string IntermediateFolder { get; }
100
101
- private bool SuppressValidation { get; }
102
-
101
public IBindResult Execute()
102
{
103
if (!this.Intermediate.HasLevel(Data.IntermediateLevels.Linked) || !this.Intermediate.HasLevel(Data.IntermediateLevels.Resolved))
@@ -587,7 +585,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
585
586
if (1 != symbols.Count)
587
{
590
- throw new WixException(ErrorMessages.MissingBundleInformation(nameof(T)));
588
+ throw new WixException($"Expected to find a single symbol of type {typeof(T).Name} but found {symbols.Count}");
589
}
590
591
return symbols[0];
src/wix/wix/ConsoleMessageListener.cs
+8
-2
@@ -48,9 +48,15 @@ namespace WixToolset.Tools.Core
48
}
49
}
50
51
- public void Write(string message) => Console.Out.WriteLine(message);
51
+ public void Write(string message)
52
+ {
53
+ Console.Out.WriteLine(message);
54
+ }
55
53
- public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel) => defaultMessageLevel;
56
+ public MessageLevel CalculateMessageLevel(IMessaging messaging, Message message, MessageLevel defaultMessageLevel)
57
+ {
58
+ return defaultMessageLevel;
59
+ }
60
61
private static IList<string> GetFileNames(SourceLineNumber sourceLineNumbers)
62
{