Skip to content

Commit a4a0e8d

Browse files
reakaleekclaude
andcommitted
fix: throw on failed Elasticsearch response instead of returning empty data
Previously, a failed search response was logged as a warning but execution continued to BuildResult, returning HTTP 200 with empty/truncated data. Now throws InvalidOperationException so the failure surfaces as an error to the caller. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e61cc0a commit a4a0e8d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/services/Elastic.Documentation.Search/ChangesGateway.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ public async Task<ChangesResult> GetChangesAsync(ChangesRequest request, Cancel
4141

4242
if (!response.IsValidResponse)
4343
{
44-
logger.LogWarning("Elasticsearch changes query returned invalid response. Reason: {Reason}",
45-
response.ElasticsearchServerError?.Error.Reason ?? "Unknown");
44+
var reason = response.ElasticsearchServerError?.Error.Reason ?? "Unknown";
45+
throw new InvalidOperationException(
46+
$"Elasticsearch changes query failed (HTTP {response.ApiCallDetails?.HttpStatusCode}): {reason}"
47+
);
4648
}
4749
}
4850

0 commit comments

Comments
 (0)