Skip to content

Commit 00e4cb1

Browse files
committed
MAGE-1122 Add exception handling
1 parent 9fb3f5f commit 00e4cb1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Service/Product/MissingPriceIndexHandler.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public function __construct(
3434
/**
3535
* @param string[]|ProductCollection $products
3636
* @return string[] Array of product IDs that were reindexed by this repair operation
37-
* @throws \Zend_Db_Select_Exception
3837
*/
3938
public function refreshPriceIndex(array|ProductCollection $products): array
4039
{
@@ -55,7 +54,6 @@ public function refreshPriceIndex(array|ProductCollection $products): array
5554
* Analyzes a product collection and determines which (if any) records should have their prices reindexed
5655
* @param string[]|ProductCollection $products - either an explicit list of product ids or a product collection
5756
* @return string[] IDs of products that require price reindexing (will be empty if no indexing is required)
58-
* @throws \Zend_Db_Select_Exception
5957
*/
6058
protected function getProductIdsToReindex(array|ProductCollection $products): array
6159
{
@@ -115,15 +113,19 @@ protected function filterProductIdsNotYetProcessed(array $productIds): array {
115113

116114
/**
117115
* Expand the query for product ids from the collection regardless of price index status
118-
* @throws \Zend_Db_Select_Exception
119116
* @return string[] An array of indices to be evaluated - array will be empty if no price index join found
120117
*/
121118
protected function getProductIdsFromCollection(ProductCollection $collection): array
122119
{
123120

124121
$select = clone $collection->getSelect();
125-
// TODO: Log this exception - pending DiagnosticsLogger
126-
$joins = $select->getPart(Zend_Db_Select::FROM);
122+
try {
123+
$joins = $select->getPart(Zend_Db_Select::FROM);
124+
} catch (\Zend_Db_Select_Exception $e) {
125+
$this->logger->error("Unable to build query for missing product prices: " . $e->getMessage());
126+
return [];
127+
}
128+
127129
$priceIndexJoin = $this->getPriceIndexJoinAlias($joins);
128130

129131
if (!$priceIndexJoin) {

0 commit comments

Comments
 (0)