Skip to content

Commit e56bbed

Browse files
committed
Added error messages for a negative channel argument
1 parent cce1409 commit e56bbed

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

Grun/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ private static void Main(string[] args)
124124
showParseTree = true;
125125
}
126126

127+
if (o.Channel < 0)
128+
{
129+
Console.WriteLine(Resources.NegativeChannelErrMsg);
130+
return;
131+
}
127132
channel = o.Channel;
128133

129134
if (!string.IsNullOrEmpty(o.SvgFileName))

Grun/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Grun/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,7 @@
141141
<data name="FileNotFoundErrorMessage" xml:space="preserve">
142142
<value>File "{0}" could not be found.</value>
143143
</data>
144+
<data name="NegativeChannelErrMsg" xml:space="preserve">
145+
<value>Channel must not be a negative number</value>
146+
</data>
144147
</root>

GunWin/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ private static void Main(string[] args)
8282
visualAnalyzer.LoadSourceFile(o.FileName, encodingToUse);
8383
}
8484

85+
if (o.Channel < 0)
86+
throw new ArgumentException("Channel must not be negative");
8587
visualAnalyzer.TokenChannel = o.Channel;
8688

8789
if (o.Diagnostics) visualAnalyzer.ParseWithDiagnostics = true;

0 commit comments

Comments
 (0)