Skip to content

Commit b46769c

Browse files
committed
don't swallow exceptions
1 parent 76e3a83 commit b46769c

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

KustoSchemaTools/Parser/KustoClusterHandler.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,18 @@ public virtual async Task<Cluster> LoadAsync()
2727

2828
_logger.LogInformation("Loading cluster capacity policy...");
2929

30-
try
30+
using (var reader = await _client.AdminClient.ExecuteControlCommandAsync("", ".show cluster policy capacity", new ClientRequestProperties()))
3131
{
32-
using (var reader = await _client.AdminClient.ExecuteControlCommandAsync("", ".show cluster policy capacity", new ClientRequestProperties()))
32+
if (reader.Read())
3333
{
34-
if (reader.Read())
34+
var policyJson = reader["Policy"]?.ToString();
35+
if (!string.IsNullOrEmpty(policyJson))
3536
{
36-
var policyJson = reader["Policy"]?.ToString();
37-
if (!string.IsNullOrEmpty(policyJson))
38-
{
39-
var policy = JsonConvert.DeserializeObject<ClusterCapacityPolicy>(policyJson);
40-
cluster.CapacityPolicy = policy;
41-
}
37+
var policy = JsonConvert.DeserializeObject<ClusterCapacityPolicy>(policyJson);
38+
cluster.CapacityPolicy = policy;
4239
}
4340
}
4441
}
45-
catch (System.Exception ex)
46-
{
47-
_logger.LogError(ex, "Failed to load cluster capacity policy.");
48-
}
4942

5043
return cluster;
5144
}

0 commit comments

Comments
 (0)