diff --git a/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-List.cs b/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-List.cs index af9651c46..f749ae994 100644 --- a/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-List.cs +++ b/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-List.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using AddressRegistry.Infrastructure.Elastic.Exceptions; using Be.Vlaanderen.Basisregisters.GrAr.Legacy.Adres; using Convertors; using global::Elastic.Clients.Elasticsearch; @@ -134,8 +135,7 @@ public async Task ListAddresses( if (!searchResponse.IsValidResponse) { - _logger.LogWarning("Failed to search for addresses: {Error}", searchResponse.ElasticsearchServerError); - return new AddressSearchResult(Enumerable.Empty().ToList(), 0); + throw new ElasticsearchClientException("Failed to search for addresses", searchResponse.ElasticsearchServerError, searchResponse.DebugInformation); } return new AddressSearchResult(searchResponse.Documents, searchResponse.Total); diff --git a/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-SearchAddresses.cs b/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-SearchAddresses.cs index cbaaf44bc..ba3a56c39 100644 --- a/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-SearchAddresses.cs +++ b/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiElasticsearchClient-SearchAddresses.cs @@ -6,6 +6,7 @@ using System.Text.Json; using System.Threading.Tasks; using AddressRegistry.Infrastructure.Elastic; + using AddressRegistry.Infrastructure.Elastic.Exceptions; using global::Elastic.Clients.Elasticsearch; using global::Elastic.Clients.Elasticsearch.QueryDsl; using Microsoft.Extensions.Logging; @@ -89,8 +90,7 @@ public async Task SearchAddresses( if (!searchResponse.IsValidResponse) { - _logger.LogWarning("Failed to search for addresses: {Error}", searchResponse.ElasticsearchServerError); - return AddressSearchResult.Empty; + throw new ElasticsearchClientException("Failed to search for addresses", searchResponse.ElasticsearchServerError, searchResponse.DebugInformation); } var language = DetermineLanguage(searchResponse); diff --git a/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiStreetNameElasticsearchClient-SearchStreetNames.cs b/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiStreetNameElasticsearchClient-SearchStreetNames.cs index b43897c4a..93861d47f 100644 --- a/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiStreetNameElasticsearchClient-SearchStreetNames.cs +++ b/src/AddressRegistry.Api.Oslo/Infrastructure/Elastic/AddressApiStreetNameElasticsearchClient-SearchStreetNames.cs @@ -6,6 +6,7 @@ using System.Text.Json; using System.Threading.Tasks; using AddressRegistry.Infrastructure.Elastic; + using AddressRegistry.Infrastructure.Elastic.Exceptions; using Consumer.Read.StreetName.Projections; using Consumer.Read.StreetName.Projections.Elastic; using global::Elastic.Clients.Elasticsearch; @@ -97,8 +98,7 @@ public async Task SearchStreetNames( if (!searchResponse.IsValidResponse) { - _logger.LogWarning("Failed to search for streetnames: {Error}", searchResponse.ElasticsearchServerError); - return StreetNameSearchResult.Empty; + throw new ElasticsearchClientException("Failed to search for streetnames", searchResponse.ElasticsearchServerError, searchResponse.DebugInformation); } var language = DetermineLanguage(searchResponse);