Skip to content

Commit 47b58f5

Browse files
committed
Merge branch 'SamJUK-patch-1' into abhi-mainline-nov-v1
2 parents 1fcfe33 + 41a992e commit 47b58f5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

InventoryInStorePickup/Model/SearchRequest/Area/GetDistanceToSources.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Magento\InventoryInStorePickupApi\Model\SearchRequest\Area\Pipeline;
1515
use Magento\InventorySourceSelectionApi\Api\Data\AddressInterface;
1616
use Magento\InventorySourceSelectionApi\Api\Data\AddressInterfaceFactory;
17+
use Psr\Log\LoggerInterface;
18+
use Magento\Framework\App\ObjectManager;
1719

1820
/**
1921
* Provide associated list of Source codes and distance to them in KM.
@@ -47,22 +49,30 @@ class GetDistanceToSources
4749
*/
4850
private $searchTermPipeline;
4951

52+
/**
53+
* @var LoggerInterface
54+
*/
55+
private $logger;
56+
5057
/**
5158
* @param GetLatsLngsFromAddressInterface $getLatsLngsFromAddress
5259
* @param GetOrderedDistanceToSources $getOrderedDistanceToSources
5360
* @param AddressInterfaceFactory $addressInterfaceFactory
5461
* @param Pipeline $searchTermPipeline
62+
* @param LoggerInterface $logger
5563
*/
5664
public function __construct(
5765
GetLatsLngsFromAddressInterface $getLatsLngsFromAddress,
5866
GetOrderedDistanceToSources $getOrderedDistanceToSources,
5967
AddressInterfaceFactory $addressInterfaceFactory,
60-
Pipeline $searchTermPipeline
68+
Pipeline $searchTermPipeline,
69+
?LoggerInterface $logger = null
6170
) {
6271
$this->getLatsLngsFromAddress = $getLatsLngsFromAddress;
6372
$this->getOrderedDistanceToSources = $getOrderedDistanceToSources;
6473
$this->addressInterfaceFactory = $addressInterfaceFactory;
6574
$this->searchTermPipeline = $searchTermPipeline;
75+
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
6676
}
6777

6878
/**
@@ -108,6 +118,7 @@ private function getDistanceToSources(AreaInterface $area): array
108118
try {
109119
$latsLngs = $this->getLatsLngsFromAddress->execute($sourceSelectionAddress);
110120
} catch (LocalizedException $exception) {
121+
$this->logger->error($exception->getMessage());
111122
return [];
112123
}
113124

0 commit comments

Comments
 (0)