Skip to content

Commit 20d517d

Browse files
committed
#40213 - Handle no entity exception for attribute set
1 parent e885088 commit 20d517d

File tree

1 file changed

+9
-1
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Product/Set

1 file changed

+9
-1
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ public function __construct(
5555
public function execute()
5656
{
5757
$this->_setTypeId();
58-
$attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id'));
58+
59+
try {
60+
$attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id'));
61+
} catch (NoSuchEntityException $e) {
62+
$this->messageManager->addErrorMessage(__('Could not load attribute set.'));
63+
64+
return $this->_redirect('*/*/');
65+
}
66+
5967
if (!$attributeSet->getId()) {
6068
return $this->resultRedirectFactory->create()->setPath('catalog/*/index');
6169
}

0 commit comments

Comments
 (0)