Skip to content

Commit e0d366b

Browse files
authored
Log exception msg and stack trace (#42)
* Log exception msg and stack trace * Bump SDK version due to CA issues
1 parent 2283072 commit e0d366b

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
git tag --list
2828
- uses: actions/setup-dotnet@v1
2929
with:
30-
dotnet-version: '5.0.100'
30+
dotnet-version: '5.0.408'
3131
source-url: https://nuget.pkg.github.com/elastic/index.json
3232
env:
3333
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "5.0.100",
3+
"version": "5.0.408",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

src/Elastic.Elasticsearch.Ephemeral/EphemeralClusterComposer.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Elastic.Elasticsearch.Ephemeral.Tasks.InstallationTasks.XPack;
1313
using Elastic.Elasticsearch.Ephemeral.Tasks.ValidationTasks;
1414
using Elastic.Elasticsearch.Managed.FileSystem;
15+
using Elastic.Elasticsearch.Managed.ConsoleWriters;
1516

1617
namespace Elastic.Elasticsearch.Ephemeral
1718
{
@@ -73,9 +74,9 @@ public class EphemeralClusterComposer<TConfiguration> : EphemeralClusterComposer
7374

7475
private bool NodeStarted { get; set; }
7576

76-
public void OnStop() => Itterate(NodeStoppedTasks, (t, c, fs) => t.Run(c, NodeStarted), false);
77+
public void OnStop() => Iterate(NodeStoppedTasks, (t, c, fs) => t.Run(c, NodeStarted), false);
7778

78-
public void Install() => Itterate(InstallationTasks, (t, c, fs) => t.Run(c));
79+
public void Install() => Iterate(InstallationTasks, (t, c, fs) => t.Run(c));
7980

8081
public void OnBeforeStart()
8182
{
@@ -86,7 +87,7 @@ public void OnBeforeStart()
8687
if (Cluster.ClusterConfiguration.PrintYamlFilesInConfigFolder)
8788
tasks.Add(new PrintYamlContents());
8889

89-
Itterate(tasks, (t, c, fs) => t.Run(c));
90+
Iterate(tasks, (t, c, fs) => t.Run(c));
9091

9192
NodeStarted = true;
9293
}
@@ -97,10 +98,10 @@ public void OnAfterStart()
9798
var tasks = new List<IClusterComposeTask>(AfterStartedTasks);
9899
if (Cluster.ClusterConfiguration.AdditionalAfterStartedTasks != null)
99100
tasks.AddRange(Cluster.ClusterConfiguration.AdditionalAfterStartedTasks);
100-
Itterate(tasks, (t, c, fs) => t.Run(c), false);
101+
Iterate(tasks, (t, c, fs) => t.Run(c), false);
101102
}
102103

103-
private void Itterate<T>(IEnumerable<T> collection,
104+
private void Iterate<T>(IEnumerable<T> collection,
104105
Action<T, IEphemeralCluster<TConfiguration>, INodeFileSystem> act, bool callOnStop = true)
105106
{
106107
lock (_lock)
@@ -111,9 +112,10 @@ private void Itterate<T>(IEnumerable<T> collection,
111112
{
112113
act(task, cluster, cluster.FileSystem);
113114
}
114-
catch (Exception)
115+
catch (Exception ex)
115116
{
116117
if (callOnStop) OnStop();
118+
cluster.Writer.WriteError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
117119
throw;
118120
}
119121
}

0 commit comments

Comments
 (0)