Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #26345 Reorder in Admin panel leads to report page in case of changed product custom option max characters #26348

Merged
merged 7 commits into from
Mar 17, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,18 @@ public function execute()
}
$resultRedirect->setPath('sales/order/view', ['order_id' => $orderId]);
} else {
$order->setReordered(true);
$this->_getSession()->setUseOldShippingMethod(true);
$this->_getOrderCreateModel()->initFromOrder($order);
$resultRedirect->setPath('sales/*');
try {
$order->setReordered(true);
$this->_getSession()->setUseOldShippingMethod(true);
$this->_getOrderCreateModel()->initFromOrder($order);
$resultRedirect->setPath('sales/*');
} catch (\Magento\Framework\Exception\LocalizedException $e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @cedmudit. I've noticed that we don't log the exception. It's not that critical in case of LocalizedException since we show the message using the messageManager. However, it's still recommended to log the exception.

In the case of catching \Exception it's very important to have the details in the error log. Otherwise, we just catch the exception and hide important error details.

Please, add error logging for both cases. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi, @rogyar. I will add an error logging.

$this->messageManager->addErrorMessage($e->getMessage());
return $resultRedirect->setPath('sales/*');
} catch (\Exception $e) {
$this->messageManager->addException($e, __('Error while processing order.'));
return $resultRedirect->setPath('sales/*');
}
}

return $resultRedirect;
Expand Down