Skip to content

Commit fd514be

Browse files
committed
rename OutOfNodesException with MaxRetryException
1 parent 4bf9315 commit fd514be

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public ConnectionConfiguration(Uri uri = null)
106106
: this(new SingleNodeConnectionPool(uri ?? new Uri("http://localhost:9200")))
107107
{
108108
//this.Host = uri.Host;
109-
//this.Port = uri.Port;
109+
//this.Port = uri.Port
110110
}
111111

112112
public T MaximumRetries(int maxRetries)

src/Elasticsearch.Net/Connection/Transport.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private ElasticsearchResponse<T> RetryRequest<T>(
128128
{
129129
return this.DoRequest<T>(method, path, data, null, deserializationState, ++retried, initialSeed);
130130
}
131-
throw new OutOfNodesException(exceptionMessage, e);
131+
throw new MaxRetryException(exceptionMessage, e);
132132
}
133133

134134
private ElasticsearchResponse<T> _doRequest<T>(string method, Uri uri, byte[] postData, object deserializationState)
@@ -205,7 +205,7 @@ private Task<ElasticsearchResponse<T>> RetryRequestAsync<T>(
205205
{
206206
return this.DoRequestAsync<T>(method, path, data, null, deserializationState, ++retried, initialSeed);
207207
}
208-
throw new OutOfNodesException(exceptionMessage, e);
208+
throw new MaxRetryException(exceptionMessage, e);
209209
}
210210
private Task<ElasticsearchResponse<T>> _doRequestAsync<T>(string method, Uri uri, byte[] postData, object deserializationState)
211211
{

src/Elasticsearch.Net/Exceptions/OutOfNodesException.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
namespace Elasticsearch.Net.Exceptions
77
{
8-
public class OutOfNodesException : Exception
8+
public class MaxRetryException : Exception
99
{
10-
public OutOfNodesException(string message) : base(message)
10+
public MaxRetryException(string message) : base(message)
1111
{
1212
}
1313

14-
public OutOfNodesException(string message, Exception innerException) : base(message, innerException)
14+
public MaxRetryException(string message, Exception innerException) : base(message, innerException)
1515
{
1616

1717
}

src/Tests/Elasticsearch.Net.Tests.Unit/Connection/RetryTests.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void ThrowsOutOfNodesException_AndRetriesTheSpecifiedTimes()
4040

4141
client.Settings.MaxRetries.Should().Be(_retries);
4242

43-
Assert.Throws<OutOfNodesException>(()=> client.Info());
43+
Assert.Throws<MaxRetryException>(()=> client.Info());
4444
getCall.MustHaveHappened(Repeated.Exactly.Times(_retries + 1));
4545

4646
}
@@ -70,11 +70,11 @@ public async void ThrowsOutOfNodesException_AndRetriesTheSpecifiedTimes_Async()
7070
}
7171
catch (AggregateException ae)
7272
{
73-
Assert.AreEqual(typeof(OutOfNodesException), ae.InnerException.GetType());
73+
Assert.AreEqual(typeof(MaxRetryException), ae.InnerException.GetType());
7474
}
7575
catch (Exception e)
7676
{
77-
Assert.AreEqual(typeof(OutOfNodesException), e.GetType());
77+
Assert.AreEqual(typeof(MaxRetryException), e.GetType());
7878
}
7979
getCall.MustHaveHappened(Repeated.Exactly.Times(_retries + 1));
8080

@@ -168,7 +168,7 @@ public void ShouldRetryOn503()
168168

169169
var client = fake.Resolve<ElasticsearchClient>();
170170

171-
Assert.Throws<OutOfNodesException>(()=> client.Info());
171+
Assert.Throws<MaxRetryException>(()=> client.Info());
172172
getCall.MustHaveHappened(Repeated.Exactly.Times(_retries + 1));
173173

174174
}
@@ -192,11 +192,11 @@ public async void ShouldRetryOn503_Async()
192192
}
193193
catch (AggregateException e)
194194
{
195-
Assert.AreEqual(e.InnerException.GetType(), typeof(OutOfNodesException));
195+
Assert.AreEqual(e.InnerException.GetType(), typeof(MaxRetryException));
196196
}
197197
catch (Exception e)
198198
{
199-
Assert.AreEqual(e.GetType(), typeof(OutOfNodesException));
199+
Assert.AreEqual(e.GetType(), typeof(MaxRetryException));
200200
}
201201
getCall.MustHaveHappened(Repeated.Exactly.Times(_retries + 1));
202202

src/Tests/Elasticsearch.Net.Tests.Unit/Connection/SniffingConnectionPoolTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void SniffOnConnectionFaultCausesSniffOn503()
164164
client1.Info(); //info call 2
165165
client1.Info(); //info call 3
166166
client1.Info(); //info call 4
167-
Assert.Throws<OutOfNodesException>(()=>client1.Info()); //info call 5
167+
Assert.Throws<MaxRetryException>(()=>client1.Info()); //info call 5
168168

169169
sniffCall.MustHaveHappened(Repeated.Exactly.Once);
170170
nowCall.MustHaveHappened(Repeated.Exactly.Times(7));

src/Tests/Elasticsearch.Net.Tests.Unit/Connection/StaticConnectionPoolRetryTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void ThrowsOutOfNodesException_AndRetriesTheSpecifiedTimes()
7474

7575
//calling GET / should throw an OutOfNodesException because our fake
7676
//will always throw an exception
77-
Assert.Throws<OutOfNodesException>(()=> client.Info());
77+
Assert.Throws<MaxRetryException>(()=> client.Info());
7878
//the GetSync method must in total have been called the number of nodes times.
7979
getCall.MustHaveHappened(Repeated.Exactly.Times(_retries + 1));
8080

@@ -106,7 +106,7 @@ public void AllNodesMustBeTriedOnce()
106106

107107
var client = fake.Resolve<ElasticsearchClient>();
108108

109-
Assert.Throws<OutOfNodesException>(()=> client.Info());
109+
Assert.Throws<MaxRetryException>(()=> client.Info());
110110

111111
//make sure we've observed an attempt on all the nodes
112112
foreach (var call in calls)
@@ -135,7 +135,7 @@ public void HardRetryLimitTakesPrecedenceOverNumberOfNodes()
135135

136136
var client = fake.Resolve<ElasticsearchClient>();
137137

138-
Assert.Throws<OutOfNodesException>(()=> client.Info());
138+
Assert.Throws<MaxRetryException>(()=> client.Info());
139139

140140
//We want to see 8 attempt to do a GET on /
141141
//(original call + retry of 7 == 8)
@@ -227,7 +227,7 @@ public void AllNodesWillBeMarkedDead()
227227
var client = fake.Resolve<ElasticsearchClient>();
228228

229229
//Since we always get a 503 we should see an out of nodes exception
230-
Assert.Throws<OutOfNodesException>(()=> client.Info());
230+
Assert.Throws<MaxRetryException>(()=> client.Info());
231231

232232
//The call should be tried on all the nodes
233233
getCall.MustHaveHappened(Repeated.Exactly.Times(4));

src/Tests/Nest.Tests.Integration/ConnectionTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void connect_to_unknown_hostname()
6363

6464
//this test will fail if fiddler is enabled since the proxy
6565
//will report a statuscode of 502 instead of -1
66-
Assert.Throws<OutOfNodesException>(() =>
66+
Assert.Throws<MaxRetryException>(() =>
6767
{
6868
var settings = new ConnectionSettings(new Uri("http://youdontownthis.domain.do.you"), "index");
6969
var client = new ElasticClient(settings);

0 commit comments

Comments
 (0)