From 38cabb781e934088a0c1921f8704e7129a205844 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Tue, 24 Mar 2026 14:07:35 +0100 Subject: [PATCH] fix: add null-conditional on Error property for ES client 9.3.3 compatibility The Elasticsearch client 9.3.3 upgrade made the Error property on ElasticsearchServerError nullable. This was fixed in other gateway files but missed in ChangesGateway and SharedPointInTimeManager, causing CS8602 compilation errors in the pre-release workflow. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Elastic.Documentation.Search/ChangesGateway.cs | 8 ++++---- .../SharedPointInTimeManager.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/Elastic.Documentation.Search/ChangesGateway.cs b/src/services/Elastic.Documentation.Search/ChangesGateway.cs index 36a768932..ecd4b3576 100644 --- a/src/services/Elastic.Documentation.Search/ChangesGateway.cs +++ b/src/services/Elastic.Documentation.Search/ChangesGateway.cs @@ -39,7 +39,7 @@ public async Task GetChangesAsync(ChangesRequest request, Cancel if (!response.IsValidResponse) { - var reason = response.ElasticsearchServerError?.Error.Reason ?? "Unknown"; + var reason = response.ElasticsearchServerError?.Error?.Reason ?? "Unknown"; throw new InvalidOperationException( $"Elasticsearch changes query failed (HTTP {response.ApiCallDetails?.HttpStatusCode}): {reason}" ); @@ -97,9 +97,9 @@ await clientAccessor.Client.SearchAsync(s => }, ctx); private static bool IsExpiredPit(SearchResponse response) => - response.ElasticsearchServerError?.Error.Type is "search_phase_execution_exception" - || response.ElasticsearchServerError?.Error.Reason?.Contains("point in time", StringComparison.OrdinalIgnoreCase) == true - || response.ElasticsearchServerError?.Error.Reason?.Contains("No search context found", StringComparison.OrdinalIgnoreCase) == true; + response.ElasticsearchServerError?.Error?.Type is "search_phase_execution_exception" + || response.ElasticsearchServerError?.Error?.Reason?.Contains("point in time", StringComparison.OrdinalIgnoreCase) == true + || response.ElasticsearchServerError?.Error?.Reason?.Contains("No search context found", StringComparison.OrdinalIgnoreCase) == true; private static ChangesResult BuildResult(SearchResponse response, int pageSize) { diff --git a/src/services/Elastic.Documentation.Search/SharedPointInTimeManager.cs b/src/services/Elastic.Documentation.Search/SharedPointInTimeManager.cs index 286fcc66c..1b0f6b637 100644 --- a/src/services/Elastic.Documentation.Search/SharedPointInTimeManager.cs +++ b/src/services/Elastic.Documentation.Search/SharedPointInTimeManager.cs @@ -62,7 +62,7 @@ private async Task OpenPit(Cancel ctx) if (!response.IsValidResponse) { throw new InvalidOperationException( - $"Failed to open PIT: {response.ElasticsearchServerError?.Error.Reason ?? "Unknown"}" + $"Failed to open PIT: {response.ElasticsearchServerError?.Error?.Reason ?? "Unknown"}" ); }