Skip to content

Commit adfbda3

Browse files
committed
Log Aggregation fix on Checkout failure (group by reason, not Quote ID)
1 parent 0a834cc commit adfbda3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Checkout\Api\PaymentProcessingRateLimiterInterface;
1212
use Magento\Checkout\Api\PaymentSavingRateLimiterInterface;
1313
use Magento\Framework\App\ObjectManager;
14+
use Magento\Framework\Exception\LocalizedException;
1415
use Magento\Quote\Api\CartRepositoryInterface;
1516
use Magento\Framework\Exception\CouldNotSaveException;
1617
use Magento\Quote\Model\Quote;
@@ -139,9 +140,13 @@ public function savePaymentInformationAndPlaceOrder(
139140
}
140141
try {
141142
$orderId = $this->cartManagement->placeOrder($cartId);
142-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
143+
} catch (LocalizedException $e) {
143144
$this->logger->critical(
144-
'Placing an order with quote_id ' . $cartId . ' is failed: ' . $e->getMessage()
145+
'Placing an Order failed (reason: '. $e->getMessage() .')',
146+
[
147+
'quote_id' => $cartId,
148+
'exception' => (string)$e
149+
]
145150
);
146151
throw new CouldNotSaveException(
147152
__($e->getMessage()),

app/code/Magento/Checkout/Model/PaymentInformationManagement.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ public function savePaymentInformationAndPlaceOrder(
152152
$orderId = $this->cartManagement->placeOrder($cartId);
153153
} catch (LocalizedException $e) {
154154
$this->logger->critical(
155-
'Placing an order with quote_id ' . $cartId . ' is failed: ' . $e->getMessage()
155+
'Placing an Order failed (reason: '. $e->getMessage() .')',
156+
[
157+
'quote_id' => $cartId,
158+
'exception' => (string)$e
159+
]
156160
);
157161
throw new CouldNotSaveException(
158162
__($e->getMessage()),

0 commit comments

Comments
 (0)