fix: exception if no images

This commit is contained in:
2025-08-14 23:11:21 +03:00
parent 9770a09fc0
commit 9bcf32841e
2 changed files with 4 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ class ProductsHandler
);
} catch (Exception $exception) {
$this->logger->logException($exception);
throw new RuntimeException('Error get product with id ' . $productId);
throw new RuntimeException('Error get product with id ' . $productId, 500, $exception);
}
return new JsonResponse([

View File

@@ -238,7 +238,9 @@ class ProductsService
->get();
$imagePaths = [];
$imagePaths[] = $product['product_image'];
if ($product['product_image']) {
$imagePaths[] = $product['product_image'];
}
foreach ($productsImages as $item) {
$imagePaths[] = $item['image'];
}