Skip to content

Commit d8b236f

Browse files
committed
Revert ResolveException until #1958 is resolved
1 parent 04fbfeb commit d8b236f

File tree

6 files changed

+1
-74
lines changed

6 files changed

+1
-74
lines changed

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
<Compile Include="ElasticLowLevelClient.cs" />
8484
<Compile Include="ElasticLowLevelClient.Generated.cs" />
8585
<Compile Include="Exceptions\ElasticsearchClientException.cs" />
86-
<Compile Include="Exceptions\ResolveException.cs" />
8786
<Compile Include="Exceptions\UnexpectedElasticsearchClientException.cs" />
8887
<Compile Include="Extensions\ExceptionExtensions.cs" />
8988
<Compile Include="Extensions\Extensions.cs" />

src/Elasticsearch.Net/Exceptions/ResolveException.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Elasticsearch.Net/Transport/Transport.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ public ElasticsearchResponse<TReturn> Request<TReturn>(HttpMethod method, string
8383
pipeline.MarkDead(node);
8484
seenExceptions.Add(pipelineException);
8585
}
86-
catch (ResolveException)
87-
{
88-
throw;
89-
}
9086
catch (Exception killerException)
9187
{
9288
throw new UnexpectedElasticsearchClientException(killerException, seenExceptions)
@@ -147,10 +143,6 @@ public async Task<ElasticsearchResponse<TReturn>> RequestAsync<TReturn>(HttpMeth
147143
pipeline.MarkDead(node);
148144
seenExceptions.Add(pipelineException);
149145
}
150-
catch (ResolveException)
151-
{
152-
throw;
153-
}
154146
catch (Exception killerException)
155147
{
156148
throw new UnexpectedElasticsearchClientException(killerException, seenExceptions)

src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private string Resolve(Expression expression, MemberInfo member, bool toLastToke
7171
: null;
7272

7373
if (name == null)
74-
throw new ResolveException("Name resolved to null for the given Expression or MemberInfo.");
74+
throw new ArgumentException("Name resolved to null for the given Expression or MemberInfo.");
7575

7676
return name;
7777
}

src/Nest/CommonAbstractions/Infer/IndexName/IndexNameResolver.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public string Resolve(IndexName i)
1818
{
1919
if (i == null || string.IsNullOrEmpty(i.Name))
2020
return this.Resolve(i.Type);
21-
ValidateIndexName(i.Name);
2221
return i.Name;
2322
}
2423

@@ -32,21 +31,7 @@ public string Resolve(Type type)
3231
if (defaultIndices.TryGetValue(type, out value) && !string.IsNullOrEmpty(value))
3332
indexName = value;
3433
}
35-
ValidateIndexName(indexName, type);
3634
return indexName;
3735
}
38-
39-
private void ValidateIndexName(string indexName, Type type = null)
40-
{
41-
if (string.IsNullOrWhiteSpace(indexName))
42-
throw new ResolveException(
43-
"Index name is null for the given type and no default index is set. "
44-
+ "Map an index name using ConnectionSettings.MapDefaultTypeIndices() "
45-
+ "or set a default index using ConnectionSettings.DefaultIndex()."
46-
);
47-
48-
if (indexName.HasAny(c => char.IsUpper(c)))
49-
throw new ResolveException($"Index names cannot contain uppercase characters: {indexName}.");
50-
}
5136
}
5237
}

src/Tests/ClientConcepts/HighLevel/Inferrence/IndexNameInference.doc.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,41 +48,5 @@ public void ExplicitMappingTakesPrecedence()
4848
var index = resolver.Resolve<Project>();
4949
index.Should().Be("projects");
5050
}
51-
52-
[U]
53-
public void UppercaseCharacterThrowsResolveException()
54-
{
55-
var settings = new ConnectionSettings()
56-
.DefaultIndex("Default")
57-
.MapDefaultTypeIndices(m => m
58-
.Add(typeof(Project), "myProjects")
59-
);
60-
61-
var resolver = new IndexNameResolver(settings);
62-
63-
var e = Assert.Throws<ResolveException>(() => resolver.Resolve<Project>());
64-
e.Message.Should().Be($"Index names cannot contain uppercase characters: myProjects.");
65-
e = Assert.Throws<ResolveException>(() => resolver.Resolve<Tag>());
66-
e.Message.Should().Be($"Index names cannot contain uppercase characters: Default.");
67-
e = Assert.Throws<ResolveException>(() => resolver.Resolve("Foo"));
68-
e.Message.Should().Be($"Index names cannot contain uppercase characters: Foo.");
69-
}
70-
71-
[U]
72-
public void NoIndexThrowsResolveException()
73-
{
74-
var settings = new ConnectionSettings();
75-
var resolver = new IndexNameResolver(settings);
76-
var e = Assert.Throws<ResolveException>(() => resolver.Resolve<Project>());
77-
e.Message.Should().Contain("Index name is null");
78-
}
79-
80-
[U]
81-
public void ResolveExceptionBubblesOut()
82-
{
83-
var client = TestClient.GetInMemoryClient(s => new ConnectionSettings());
84-
var e = Assert.Throws<ResolveException>(() => client.Search<Project>());
85-
86-
}
8751
}
8852
}

0 commit comments

Comments
 (0)