Skip to content

Commit 82c1b65

Browse files
committed
Add product checks
1 parent 4fab90d commit 82c1b65

File tree

5 files changed

+367
-143
lines changed

5 files changed

+367
-143
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ public interface IRequestPipeline : IDisposable
1515
bool FirstPoolUsageNeedsSniffing { get; }
1616
bool IsTakingTooLong { get; }
1717
int MaxRetries { get; }
18-
1918
int Retried { get; }
2019
bool SniffsOnConnectionFailure { get; }
2120
bool SniffsOnStaleCluster { get; }
2221
bool StaleClusterState { get; }
23-
2422
DateTime StartedOn { get; }
2523

2624
TResponse CallElasticsearch<TResponse>(RequestData requestData)

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
namespace Elasticsearch.Net
88
{
9+
public class InvalidProductException : Exception
10+
{
11+
public InvalidProductException()
12+
: base(@"TODO: This client is designed to work with the official Elasticsearch product...
13+
14+
Why are you seeing this error?
15+
------------------------------
16+
TODO") { }
17+
}
18+
919
public class PipelineException : Exception
1020
{
1121
public PipelineException(PipelineFailure failure)
@@ -18,9 +28,7 @@ public PipelineException(PipelineFailure failure, Exception innerException)
1828
public PipelineFailure FailureReason { get; }
1929

2030
public bool Recoverable =>
21-
FailureReason == PipelineFailure.BadRequest
22-
|| FailureReason == PipelineFailure.BadResponse
23-
|| FailureReason == PipelineFailure.PingFailure;
31+
FailureReason is PipelineFailure.BadRequest or PipelineFailure.BadResponse or PipelineFailure.PingFailure;
2432

2533
public IElasticsearchResponse Response { get; internal set; }
2634

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
namespace Elasticsearch.Net
6+
{
7+
/// <summary>
8+
/// Represents the status of the pre-flight product checks.
9+
/// </summary>
10+
public enum ProductCheckStatus
11+
{
12+
NotChecked,
13+
ValidProduct,
14+
InvalidProduct,
15+
UndeterminedProduct
16+
}
17+
}

0 commit comments

Comments
 (0)