Skip to content

Commit 3592a46

Browse files
ENGCOM-4520: Root exception not logged on QuoteManagement::submitQuote #21697
- Merge Pull Request #21697 from david-fuehr/magento2:issue-18752-original-exception-lost - Merged commits: 1. 9480e2a 2. 04f60d5 3. 6b0ebf4
2 parents 3666e03 + 6b0ebf4 commit 3592a46

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -532,19 +532,28 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
532532
);
533533
$this->quoteRepository->save($quote);
534534
} catch (\Exception $e) {
535-
if (!empty($this->addressesToSync)) {
536-
foreach ($this->addressesToSync as $addressId) {
537-
$this->addressRepository->deleteById($addressId);
535+
try {
536+
if (!empty($this->addressesToSync)) {
537+
foreach ($this->addressesToSync as $addressId) {
538+
$this->addressRepository->deleteById($addressId);
539+
}
538540
}
541+
$this->eventManager->dispatch(
542+
'sales_model_service_quote_submit_failure',
543+
[
544+
'order' => $order,
545+
'quote' => $quote,
546+
'exception' => $e,
547+
]
548+
);
549+
} catch (\Exception $consecutiveException) {
550+
$message = sprintf(
551+
"An exception occurred on 'sales_model_service_quote_submit_failure' event: %s",
552+
$consecutiveException->getMessage()
553+
);
554+
555+
throw new \Exception($message, 0, $e);
539556
}
540-
$this->eventManager->dispatch(
541-
'sales_model_service_quote_submit_failure',
542-
[
543-
'order' => $order,
544-
'quote' => $quote,
545-
'exception' => $e
546-
]
547-
);
548557
throw $e;
549558
}
550559
return $order;

0 commit comments

Comments
 (0)