Skip to content

Commit aac255f

Browse files
author
Yuri Kovsher
committed
MAGETWO-33814: Change parent class of Model\Exception sub-classes to Localized
1 parent 8352914 commit aac255f

File tree

3 files changed

+8
-12
lines changed
  • app/code/Magento

3 files changed

+8
-12
lines changed

app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function execute()
9090
}
9191
$redirectResult->setPath('adminhtml/*/');
9292
return $redirectResult;
93-
} catch (\Magento\Framework\Model\Exception $e) {
93+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
9494
$this->messageManager->addError($e->getMessage());
9595
$this->_getSession()->setPostData($postData);
9696
} catch (\Exception $e) {

app/code/Magento/Catalog/Controller/Product/View.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,13 @@ public function execute()
108108
$page = $this->resultPageFactory->create(false, ['isIsolated' => true]);
109109
$this->viewHelper->prepareAndRender($page, $productId, $this, $params);
110110
return $page;
111+
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
112+
return $this->noProductRedirect();
111113
} catch (\Exception $e) {
112-
if ($e->getCode() == $this->viewHelper->ERR_NO_PRODUCT_LOADED) {
113-
return $this->noProductRedirect();
114-
} else {
115-
$this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
116-
$resultForward = $this->resultForwardFactory->create();
117-
$resultForward->forward('noroute');
118-
return $resultForward;
119-
}
114+
$this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
115+
$resultForward = $this->resultForwardFactory->create();
116+
$resultForward->forward('noroute');
117+
return $resultForward;
120118
}
121119
}
122120
}

app/code/Magento/Catalog/Helper/Product/View.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
class View extends \Magento\Framework\App\Helper\AbstractHelper
1717
{
1818
// List of exceptions throwable during prepareAndRender() method
19-
public $ERR_NO_PRODUCT_LOADED = 1;
20-
2119
public $ERR_BAD_CONTROLLER_INTERFACE = 2;
2220

2321
/**
@@ -198,7 +196,7 @@ public function prepareAndRender(ResultPage $resultPage, $productId, $controller
198196
// Standard algorithm to prepare and render product view page
199197
$product = $productHelper->initProduct($productId, $controller, $params);
200198
if (!$product) {
201-
throw new \Magento\Framework\Model\Exception(__('Product is not loaded'), $this->ERR_NO_PRODUCT_LOADED);
199+
throw new \Magento\Framework\Exception\NoSuchEntityException(__('Product is not loaded'));
202200
}
203201

204202
$buyRequest = $params->getBuyRequest();

0 commit comments

Comments
 (0)