Skip to content

Commit

Permalink
Log exceptions during disposal (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejgordon authored Jul 5, 2022
1 parent e0d366b commit 9afc750
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Elastic.Elasticsearch.Managed/ClusterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,18 @@ public IDisposable Start(IConsoleLineHandler writer, TimeSpan waitForStarted)

public void Dispose()
{
Started = false;
foreach (var node in Nodes)
node?.Dispose();
try
{
Started = false;
foreach (var node in Nodes)
node?.Dispose();

OnDispose();
OnDispose();
}
catch(Exception ex)
{
Writer.WriteError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
}
}

protected virtual void ModifyNodeConfiguration(NodeConfiguration nodeConfiguration, int port)
Expand Down

0 comments on commit 9afc750

Please sign in to comment.