Skip to content

Commit 357a134

Browse files
authored
Merge pull request #94 from github/caol-ila-hide-error-fix
Move error reporting out of follower loop
2 parents d70cf29 + 5a59897 commit 357a134

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

KustoSchemaTools/Parser/KustoWriter/DefaultDatabaseWriter.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public async Task WriteAsync(Database sourceDb, Database targetDb, KustoClient c
2929
var followerChanges = DatabaseChanges.GenerateFollowerChanges(source, follower.Value, logger);
3030

3131
var followerResults = await ApplyChangesToDatabase(follower.Value.DatabaseName, followerChanges, followerClient, logger);
32+
results.AddRange(followerResults);
3233

3334
Console.WriteLine();
3435
Console.WriteLine($"Follower: {follower.Key}");
@@ -44,15 +45,15 @@ public async Task WriteAsync(Database sourceDb, Database targetDb, KustoClient c
4445
Console.WriteLine();
4546
Console.WriteLine();
4647

47-
var exs = results.Where(itm => itm.Result == "Failed").Select(itm => new Exception($"Execution failed for command \n{itm.CommandText} \n with reason\n{itm.Reason}")).ToList();
48-
if (exs.Count == 1)
49-
{
50-
throw exs[0];
51-
}
52-
if (exs.Count > 1)
53-
{
54-
throw new AggregateException(exs);
55-
}
48+
}
49+
var exs = results.Where(itm => itm.Result == "Failed").Select(itm => new Exception($"Execution failed for command \n{itm.CommandText} \n with reason\n{itm.Reason}")).ToList();
50+
if (exs.Count == 1)
51+
{
52+
throw exs[0];
53+
}
54+
if (exs.Count > 1)
55+
{
56+
throw new AggregateException(exs);
5657
}
5758
}
5859

0 commit comments

Comments
 (0)