Skip to content

Conversation

SamJUK
Copy link

@SamJUK SamJUK commented Apr 24, 2025

Log exceptions encountered during In Stock Pickup source distance calculation instead of silently discarding them.

Fixes: #3420

@engcom-Hotel
Copy link
Collaborator

@magento run all tests

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds error logging to the source distance calculation functionality in the In Store Pickup module. When an exception occurs during address-to-coordinates conversion, it will now be logged instead of silently failing.

  • Adds logging of LocalizedException during source distance calculation
  • Introduces LoggerInterface dependency injection with fallback to ObjectManager

/**
* @param GetLatsLngsFromAddressInterface $getLatsLngsFromAddress
* @param GetOrderedDistanceToSources $getOrderedDistanceToSources
* @param AddressInterfaceFactory $addressInterfaceFactory
* @param Pipeline $searchTermPipeline
* @param Logger $logger
Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @param documentation shows 'Logger' but the actual parameter type is 'LoggerInterface'. This should be '@param LoggerInterface $logger' to match the type hint.

Suggested change
* @param Logger $logger
* @param LoggerInterface $logger

Copilot uses AI. Check for mistakes.

@magento magento deleted a comment from Copilot AI Jul 30, 2025
Copy link
Collaborator

@engcom-Hotel engcom-Hotel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @SamJUK,

Thanks for the contribution!

Please look into the below review comments. And also check the review comments made by the Copilot.

The failed tests seems flaky to me, will re-run to be double sure.

Thanks

*/
public function __construct(
GetLatsLngsFromAddressInterface $getLatsLngsFromAddress,
GetOrderedDistanceToSources $getOrderedDistanceToSources,
AddressInterfaceFactory $addressInterfaceFactory,
Pipeline $searchTermPipeline
Pipeline $searchTermPipeline,
LoggerInterface $logger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$logger should be null by default

Suggested change
LoggerInterface $logger
LoggerInterface $logger=null

@engcom-Hotel
Copy link
Collaborator

@magento run Functional Tests B2B, Functional Tests CE, Integration Tests, Static Tests, Unit Tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In store pickup silently discards exceptions
2 participants