Skip to content

Commit ad83273

Browse files
authored
Rename InvalidProductException to UnsupportedProductException (#5930)
1 parent 9f2078e commit ad83273

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

src/Elasticsearch.Net/Transport/Pipeline/RequestPipeline.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ public void FirstPoolUsage(SemaphoreSlim semaphore)
272272
switch (_connectionPool.ProductCheckStatus)
273273
{
274274
case ProductCheckStatus.InvalidProduct:
275-
throw new InvalidProductException(InvalidProductException.InvalidProductError);
275+
throw new UnsupportedProductException(UnsupportedProductException.InvalidProductError);
276276
case ProductCheckStatus.UnsupportedBuildFlavor:
277-
throw new InvalidProductException(InvalidProductException.InvalidBuildFlavorError);
277+
throw new UnsupportedProductException(UnsupportedProductException.InvalidBuildFlavorError);
278278
}
279279

280280
// If sniffing has completed and the product check has run, we are done!
@@ -322,9 +322,9 @@ public void FirstPoolUsage(SemaphoreSlim semaphore)
322322
switch (_connectionPool.ProductCheckStatus)
323323
{
324324
case ProductCheckStatus.InvalidProduct:
325-
throw new InvalidProductException(InvalidProductException.InvalidProductError);
325+
throw new UnsupportedProductException(UnsupportedProductException.InvalidProductError);
326326
case ProductCheckStatus.UnsupportedBuildFlavor:
327-
throw new InvalidProductException(InvalidProductException.InvalidBuildFlavorError);
327+
throw new UnsupportedProductException(UnsupportedProductException.InvalidBuildFlavorError);
328328
}
329329

330330
if (!FirstPoolUsageNeedsSniffing)
@@ -348,9 +348,9 @@ public async Task FirstPoolUsageAsync(SemaphoreSlim semaphore, CancellationToken
348348
switch (_connectionPool.ProductCheckStatus)
349349
{
350350
case ProductCheckStatus.InvalidProduct:
351-
throw new InvalidProductException(InvalidProductException.InvalidProductError);
351+
throw new UnsupportedProductException(UnsupportedProductException.InvalidProductError);
352352
case ProductCheckStatus.UnsupportedBuildFlavor:
353-
throw new InvalidProductException(InvalidProductException.InvalidBuildFlavorError);
353+
throw new UnsupportedProductException(UnsupportedProductException.InvalidBuildFlavorError);
354354
}
355355

356356
// If sniffing has completed and the product check has run, we are done!
@@ -402,9 +402,9 @@ public async Task FirstPoolUsageAsync(SemaphoreSlim semaphore, CancellationToken
402402
switch (_connectionPool.ProductCheckStatus)
403403
{
404404
case ProductCheckStatus.InvalidProduct:
405-
throw new InvalidProductException(InvalidProductException.InvalidProductError);
405+
throw new UnsupportedProductException(UnsupportedProductException.InvalidProductError);
406406
case ProductCheckStatus.UnsupportedBuildFlavor:
407-
throw new InvalidProductException(InvalidProductException.InvalidBuildFlavorError);
407+
throw new UnsupportedProductException(UnsupportedProductException.InvalidBuildFlavorError);
408408
}
409409

410410
if (FirstPoolUsageNeedsSniffing)

src/Elasticsearch.Net/Transport/Pipeline/InvalidProductException.cs renamed to src/Elasticsearch.Net/Transport/Pipeline/UnsupportedProductException.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66

77
namespace Elasticsearch.Net
88
{
9-
public class InvalidProductException : Exception
9+
/// <summary>
10+
/// Thrown when the client pre-flight check determines that the server is not a supported Elasticsearch product.
11+
/// </summary>
12+
public class UnsupportedProductException : Exception
1013
{
11-
internal const string InvalidProductError = "The client noticed that the server is not Elasticsearch and we do not support this unknown product.";
1214
internal const string InvalidBuildFlavorError = "The client noticed that the server is not a supported distribution of Elasticsearch.";
1315

14-
public InvalidProductException(string error)
16+
internal const string InvalidProductError =
17+
"The client noticed that the server is not Elasticsearch and we do not support this unknown product.";
18+
19+
public UnsupportedProductException(string error)
1520
: base(error) { }
1621
}
1722
}

tests/Tests/ClientConcepts/ProductCheckTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ [U] public void MissingProductNameHeaderCausesExceptionOnVersion7_14()
2525

2626
client.Invoking(y => y.Cluster.Health())
2727
.Should()
28-
.Throw<InvalidProductException>();
28+
.Throw<UnsupportedProductException>();
2929
}
3030

3131
[U] public void InvalidProductNameHeaderCausesException()
@@ -40,7 +40,7 @@ [U] public void InvalidProductNameHeaderCausesException()
4040

4141
client.Invoking(y => y.Cluster.Health())
4242
.Should()
43-
.Throw<InvalidProductException>();
43+
.Throw<UnsupportedProductException>();
4444
}
4545

4646
[U] public void UnauthorizedStatusCodeFromRootPathDoesNotThrowException_WithExpectedDataOnApiCall()
@@ -87,7 +87,7 @@ [U] public void OldVersionsThrowException()
8787

8888
client.Invoking(y => y.Cluster.Health())
8989
.Should()
90-
.Throw<InvalidProductException>();
90+
.Throw<UnsupportedProductException>();
9191
}
9292

9393
[U] public void MissingTaglineOnVersionSixThrowsException()
@@ -102,7 +102,7 @@ [U] public void MissingTaglineOnVersionSixThrowsException()
102102

103103
client.Invoking(y => y.Cluster.Health())
104104
.Should()
105-
.Throw<InvalidProductException>();
105+
.Throw<UnsupportedProductException>();
106106
}
107107

108108
[U] public void InvalidTaglineOnVersionSixThrowsException()
@@ -117,7 +117,7 @@ [U] public void InvalidTaglineOnVersionSixThrowsException()
117117

118118
client.Invoking(y => y.Cluster.Health())
119119
.Should()
120-
.Throw<InvalidProductException>();
120+
.Throw<UnsupportedProductException>();
121121
}
122122

123123
[U] public void ExpectedTaglineOnVersionSixDoesNotThrowException_WithExpectedDataOnApiCall()
@@ -148,7 +148,7 @@ [U] public void MissingBuildFlavorOnVersionSevenThrowsException()
148148

149149
client.Invoking(y => y.Cluster.Health())
150150
.Should()
151-
.Throw<InvalidProductException>();
151+
.Throw<UnsupportedProductException>();
152152
}
153153

154154
[U] public void InvalidBuildFlavorMissingOnVersionSevenThrowsException()
@@ -163,7 +163,7 @@ [U] public void InvalidBuildFlavorMissingOnVersionSevenThrowsException()
163163

164164
client.Invoking(y => y.Cluster.Health())
165165
.Should()
166-
.Throw<InvalidProductException>();
166+
.Throw<UnsupportedProductException>();
167167
}
168168

169169
[U] public void ExpectedBuildFlavorOnVersionSixDoesNotThrowException_WithExpectedDataOnApiCall()

0 commit comments

Comments
 (0)