Skip to content

Commit 3babbf5

Browse files
committed
ACP2E-3892: [Mainline] Unpopulated pages are cached due to search engine errors
1 parent 01f3598 commit 3babbf5

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

app/code/Magento/AdvancedSearch/Model/Client/ClientException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
namespace Magento\AdvancedSearch\Model\Client;
99

10-
class ClientException extends \Exception
10+
use Magento\Framework\Exception\LocalizedException;
11+
12+
class ClientException extends LocalizedException
1113
{
1214

1315
}

app/code/Magento/Elasticsearch/ElasticAdapter/SearchAdapter/Adapter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function __construct(
8383
*
8484
* @param RequestInterface $request
8585
* @return QueryResponse
86+
* @throws ClientException
8687
*/
8788
public function query(RequestInterface $request)
8889
{
@@ -95,7 +96,7 @@ public function query(RequestInterface $request)
9596
$rawResponse = $client->query($query);
9697
} catch (\Exception $e) {
9798
$this->logger->critical($e);
98-
throw new ClientException(__($e->getMessage()), $e->getCode(), $e);
99+
throw new ClientException(__("Could not perform search query."), $e->getCode(), $e);
99100
}
100101

101102
$rawDocuments = isset($rawResponse['hits']['hits']) ? $rawResponse['hits']['hits'] : [];

app/code/Magento/Elasticsearch8/SearchAdapter/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function query(RequestInterface $request): QueryResponse
9898
$rawResponse = $client->query($query);
9999
} catch (\Exception $e) {
100100
$this->logger->critical($e);
101-
throw new ClientException($e->getMessage(), $e->getCode(), $e);
101+
throw new ClientException(__("Could not perform search query."), $e->getCode(), $e);
102102
}
103103

104104
$rawDocuments = $rawResponse['hits']['hits'] ?? [];

app/code/Magento/OpenSearch/SearchAdapter/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function query(RequestInterface $request) : QueryResponse
138138
);
139139
} catch (\Exception $e) {
140140
$this->logger->critical($e);
141-
throw new ClientException($e->getMessage(), $e->getCode(), $e);
141+
throw new ClientException(__("Could not perform search query."), $e->getCode(), $e);
142142
} finally {
143143
if (isset($pitId)) {
144144
$client->closePointInTime(['body' => ['pit_id' => [$pitId]]]);

0 commit comments

Comments
 (0)