From 9bcf32841ebd4663b5c6bd5e855b18e8cd486e45 Mon Sep 17 00:00:00 2001 From: Nikita Kiselev Date: Thu, 14 Aug 2025 23:11:21 +0300 Subject: [PATCH] fix: exception if no images --- .../upload/oc_telegram_shop/src/Handlers/ProductsHandler.php | 2 +- .../upload/oc_telegram_shop/src/Services/ProductsService.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/ProductsHandler.php b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/ProductsHandler.php index a4ba38c..f84ed30 100755 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/ProductsHandler.php +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/ProductsHandler.php @@ -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([ diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/ProductsService.php b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/ProductsService.php index 696e42b..6e97314 100755 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/ProductsService.php +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/ProductsService.php @@ -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']; }