diff --git a/src/Elasticsearch.Net/Elasticsearch.Net.csproj b/src/Elasticsearch.Net/Elasticsearch.Net.csproj
index a9ab0cb6201..05eecd78a27 100644
--- a/src/Elasticsearch.Net/Elasticsearch.Net.csproj
+++ b/src/Elasticsearch.Net/Elasticsearch.Net.csproj
@@ -82,7 +82,6 @@
-
diff --git a/src/Elasticsearch.Net/Exceptions/ResolveException.cs b/src/Elasticsearch.Net/Exceptions/ResolveException.cs
deleted file mode 100644
index 98293512a06..00000000000
--- a/src/Elasticsearch.Net/Exceptions/ResolveException.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Elasticsearch.Net
-{
- public class ResolveException : Exception
- {
- public ResolveException(string message) : base(message) { }
- }
-}
diff --git a/src/Elasticsearch.Net/Transport/Transport.cs b/src/Elasticsearch.Net/Transport/Transport.cs
index ac7810489ee..c22049f9cc6 100644
--- a/src/Elasticsearch.Net/Transport/Transport.cs
+++ b/src/Elasticsearch.Net/Transport/Transport.cs
@@ -84,10 +84,6 @@ public ElasticsearchResponse Request(HttpMethod method, string
pipeline.MarkDead(node);
seenExceptions.Add(pipelineException);
}
- catch (ResolveException)
- {
- throw;
- }
catch (Exception killerException)
{
throw new UnexpectedElasticsearchClientException(killerException, seenExceptions)
@@ -149,10 +145,6 @@ public async Task> RequestAsync(HttpMeth
pipeline.MarkDead(node);
seenExceptions.Add(pipelineException);
}
- catch (ResolveException)
- {
- throw;
- }
catch (Exception killerException)
{
throw new UnexpectedElasticsearchClientException(killerException, seenExceptions)
diff --git a/src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs b/src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs
index 2376651ead8..9083f2f20e9 100644
--- a/src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs
+++ b/src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs
@@ -80,7 +80,7 @@ private string Resolve(Expression expression, MemberInfo member, bool toLastToke
: null;
if (name == null)
- throw new ResolveException("Name resolved to null for the given Expression or MemberInfo.");
+ throw new ArgumentException("Name resolved to null for the given Expression or MemberInfo.");
return name;
}
diff --git a/src/Nest/CommonAbstractions/Infer/IndexName/IndexNameResolver.cs b/src/Nest/CommonAbstractions/Infer/IndexName/IndexNameResolver.cs
index d81a89afd90..0e3568c5e16 100644
--- a/src/Nest/CommonAbstractions/Infer/IndexName/IndexNameResolver.cs
+++ b/src/Nest/CommonAbstractions/Infer/IndexName/IndexNameResolver.cs
@@ -39,14 +39,14 @@ public string Resolve(Type type)
private static void ValidateIndexName(string indexName)
{
if (string.IsNullOrWhiteSpace(indexName))
- throw new ResolveException(
+ throw new ArgumentException(
"Index name is null for the given type and no default index is set. "
+ "Map an index name using ConnectionSettings.MapDefaultTypeIndices() "
+ "or set a default index using ConnectionSettings.DefaultIndex()."
);
if (indexName.HasAny(char.IsUpper))
- throw new ResolveException($"Index names cannot contain uppercase characters: {indexName}.");
+ throw new ArgumentException($"Index names cannot contain uppercase characters: {indexName}.");
}
}
}
diff --git a/src/Tests/ClientConcepts/HighLevel/Inference/IndexNameInference.doc.cs b/src/Tests/ClientConcepts/HighLevel/Inference/IndexNameInference.doc.cs
index cc0b319a53f..b339d946f11 100644
--- a/src/Tests/ClientConcepts/HighLevel/Inference/IndexNameInference.doc.cs
+++ b/src/Tests/ClientConcepts/HighLevel/Inference/IndexNameInference.doc.cs
@@ -100,7 +100,7 @@ [U] public void ExplicitIndexOnRequestTakesPrecedence()
}
//hide
- [U] public void UppercaseCharacterThrowsResolveException()
+ [U] public void UppercaseCharacterThrowsArgumentException()
{
var settings = new ConnectionSettings()
.DefaultIndex("Default")
@@ -110,28 +110,30 @@ [U] public void UppercaseCharacterThrowsResolveException()
var resolver = new IndexNameResolver(settings);
- var e = Assert.Throws(() => resolver.Resolve());
+ var e = Assert.Throws(() => resolver.Resolve());
e.Message.Should().Be($"Index names cannot contain uppercase characters: myProjects.");
- e = Assert.Throws(() => resolver.Resolve());
+
+ e = Assert.Throws(() => resolver.Resolve());
e.Message.Should().Be($"Index names cannot contain uppercase characters: Default.");
- e = Assert.Throws(() => resolver.Resolve("Foo"));
+
+ e = Assert.Throws(() => resolver.Resolve("Foo"));
e.Message.Should().Be($"Index names cannot contain uppercase characters: Foo.");
}
//hide
- [U] public void NoIndexThrowsResolveException()
+ [U] public void NoIndexThrowsArgumentException()
{
var settings = new ConnectionSettings();
var resolver = new IndexNameResolver(settings);
- var e = Assert.Throws(() => resolver.Resolve());
+ var e = Assert.Throws(() => resolver.Resolve());
e.Message.Should().Contain("Index name is null");
}
//hide
- [U] public void ResolveExceptionBubblesOut()
+ [U] public void ArgumentExceptionBubblesOut()
{
var client = TestClient.GetClient(s => new ConnectionSettings());
- var e = Assert.Throws(() => client.Search());
+ var e = Assert.Throws(() => client.Search());
}
}
}
diff --git a/src/Tests/ClientConcepts/LowLevel/Connecting.doc.cs b/src/Tests/ClientConcepts/LowLevel/Connecting.doc.cs
index 4cd76d364ce..3c86b0e4d2d 100644
--- a/src/Tests/ClientConcepts/LowLevel/Connecting.doc.cs
+++ b/src/Tests/ClientConcepts/LowLevel/Connecting.doc.cs
@@ -131,12 +131,12 @@ public void AvailableOptions()
* root causing exception.
*
* `UnexpectedElasticsearchClientException`:: These are unknown exceptions, for instance a response from Elasticsearch not
- * properly deserialized. These are usually bugs and {github}/issues[should be reported]. This exception also inherits from `ElasticsearchClientException`
+ * properly deserialized. These are sometimes bugs and {github}/issues[should be reported]. This exception also inherits from `ElasticsearchClientException`
* so an additional catch block isn't necessary, but can be helpful in distinguishing between the two.
*
* Development time exceptions:: These are CLR exceptions like `ArgumentException`, `ArgumentOutOfRangeException`, etc.
- * that are thrown when an API in the client is misused.
- * These should not be handled as you want to know about them during development.
+ * that are thrown when an API in the client is misused. The `.ThrowExceptions()` setting has no bearing on these as
+ * they will always be thrown, and also should not be handled by a consumer.
*
*/
}