Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Elasticsearch.Net/Elasticsearch.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
<Compile Include="ElasticLowLevelClient.cs" />
<Compile Include="ElasticLowLevelClient.Generated.cs" />
<Compile Include="Exceptions\ElasticsearchClientException.cs" />
<Compile Include="Exceptions\ResolveException.cs" />
<Compile Include="Exceptions\UnexpectedElasticsearchClientException.cs" />
<Compile Include="Extensions\EnumExtensions.cs" />
<Compile Include="Extensions\Extensions.cs" />
Expand Down
13 changes: 0 additions & 13 deletions src/Elasticsearch.Net/Exceptions/ResolveException.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/Elasticsearch.Net/Transport/Transport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ public ElasticsearchResponse<TReturn> Request<TReturn>(HttpMethod method, string
pipeline.MarkDead(node);
seenExceptions.Add(pipelineException);
}
catch (ResolveException)
{
throw;
}
catch (Exception killerException)
{
throw new UnexpectedElasticsearchClientException(killerException, seenExceptions)
Expand Down Expand Up @@ -149,10 +145,6 @@ public async Task<ElasticsearchResponse<TReturn>> RequestAsync<TReturn>(HttpMeth
pipeline.MarkDead(node);
seenExceptions.Add(pipelineException);
}
catch (ResolveException)
{
throw;
}
catch (Exception killerException)
{
throw new UnexpectedElasticsearchClientException(killerException, seenExceptions)
Expand Down
2 changes: 1 addition & 1 deletion src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ [U] public void ExplicitIndexOnRequestTakesPrecedence()
}

//hide
[U] public void UppercaseCharacterThrowsResolveException()
[U] public void UppercaseCharacterThrowsArgumentException()
{
var settings = new ConnectionSettings()
.DefaultIndex("Default")
Expand All @@ -110,28 +110,30 @@ [U] public void UppercaseCharacterThrowsResolveException()

var resolver = new IndexNameResolver(settings);

var e = Assert.Throws<ResolveException>(() => resolver.Resolve<Project>());
var e = Assert.Throws<ArgumentException>(() => resolver.Resolve<Project>());
e.Message.Should().Be($"Index names cannot contain uppercase characters: myProjects.");
e = Assert.Throws<ResolveException>(() => resolver.Resolve<Tag>());

e = Assert.Throws<ArgumentException>(() => resolver.Resolve<Tag>());
e.Message.Should().Be($"Index names cannot contain uppercase characters: Default.");
e = Assert.Throws<ResolveException>(() => resolver.Resolve("Foo"));

e = Assert.Throws<ArgumentException>(() => 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<ResolveException>(() => resolver.Resolve<Project>());
var e = Assert.Throws<ArgumentException>(() => resolver.Resolve<Project>());
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<ResolveException>(() => client.Search<Project>());
var e = Assert.Throws<ArgumentException>(() => client.Search<Project>());
}
}
}
6 changes: 3 additions & 3 deletions src/Tests/ClientConcepts/LowLevel/Connecting.doc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
*/
}
Expand Down