Skip to content

Commit 9afc750

Browse files
authored
Log exceptions during disposal (#43)
1 parent e0d366b commit 9afc750

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Elastic.Elasticsearch.Managed/ClusterBase.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,18 @@ public IDisposable Start(IConsoleLineHandler writer, TimeSpan waitForStarted)
140140

141141
public void Dispose()
142142
{
143-
Started = false;
144-
foreach (var node in Nodes)
145-
node?.Dispose();
143+
try
144+
{
145+
Started = false;
146+
foreach (var node in Nodes)
147+
node?.Dispose();
146148

147-
OnDispose();
149+
OnDispose();
150+
}
151+
catch(Exception ex)
152+
{
153+
Writer.WriteError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
154+
}
148155
}
149156

150157
protected virtual void ModifyNodeConfiguration(NodeConfiguration nodeConfiguration, int port)

0 commit comments

Comments
 (0)