Skip to content

Commit 1e89b91

Browse files
committed
Fix failing exception integration tests
1 parent f2150fd commit 1e89b91

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Tests/ClientConcepts/Exceptions/ExceptionTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ public void ClientTestWhenThrowExceptionsEnabled()
4545
var client = new ElasticClient(settings);
4646
var exception = Assert.Throws<ElasticsearchClientException>(() => client.RootNodeInfo());
4747
var inner = exception.InnerException;
48+
#if DOTNETCORE
49+
// HttpClient does not throw on "known error" status codes (i.e. 404) thus OriginalException should not be set
50+
inner.Should().BeNull();
51+
#else
4852
inner.Should().NotBeNull();
53+
#endif
4954
}
5055

5156
[I]
@@ -70,7 +75,12 @@ public void ClientTestWhenThrowExceptionsDisabled()
7075
var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"));
7176
var client = new ElasticClient(settings);
7277
var response = client.RootNodeInfo();
78+
#if DOTNETCORE
79+
// HttpClient does not throw on "known error" status codes (i.e. 404) thus OriginalException should not be set
80+
response.CallDetails.OriginalException.Should().BeNull();
81+
#else
7382
response.CallDetails.OriginalException.Should().NotBeNull();
83+
#endif
7484
response.CallDetails.ServerError.Should().BeNull();
7585
}
7686
}

0 commit comments

Comments
 (0)