Skip to content

Commit

Permalink
improved error messages #33
Browse files Browse the repository at this point in the history
  • Loading branch information
irongut committed Feb 19, 2022
1 parent 4c87691 commit 1699cd4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/CodeCoverageSummary/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static int Main(string[] args)
{
if (!File.Exists(file))
{
Console.WriteLine($"Error: Code coverage file not found - {file}.");
Console.WriteLine($"Error: Coverage file not found - {file}.");
return -2; // error
}
}
Expand All @@ -46,7 +46,7 @@ private static int Main(string[] args)
CodeSummary summary = new();
foreach (var file in matchingFiles)
{
Console.WriteLine($"Code Coverage File: {file}");
Console.WriteLine($"Coverage File: {file}");
summary = ParseTestResults(file, summary);
}
Expand Down Expand Up @@ -160,7 +160,7 @@ private static CodeSummary ParseTestResults(string filename, CodeSummary summary
select item;

if (!lineR.Any())
throw new Exception("Summary Line Rate not found");
throw new Exception("Overall line rate not found");

summary.LineRate += double.Parse(lineR.First().Value);

Expand All @@ -169,7 +169,7 @@ private static CodeSummary ParseTestResults(string filename, CodeSummary summary
select item;

if (!linesCovered.Any())
throw new Exception("Summary Lines Covered not found");
throw new Exception("Overall lines covered not found");

summary.LinesCovered += int.Parse(linesCovered.First().Value);

Expand All @@ -178,7 +178,7 @@ private static CodeSummary ParseTestResults(string filename, CodeSummary summary
select item;

if (!linesValid.Any())
throw new Exception("Summary Lines Valid not found");
throw new Exception("Overall lines valid not found");

summary.LinesValid += int.Parse(linesValid.First().Value);

Expand Down Expand Up @@ -209,6 +209,9 @@ private static CodeSummary ParseTestResults(string filename, CodeSummary summary
var packages = from item in coverage.Descendants("package")
select item;

if (!packages.Any())
throw new Exception("No package data found");

int i = 1;
foreach (var item in packages)
{
Expand Down

0 comments on commit 1699cd4

Please sign in to comment.