Skip to content

Commit 7649543

Browse files
committed
revert throw to try block
1 parent d122997 commit 7649543

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Controller/Adminhtml/Actions.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,15 @@ protected function _newAction()
155155
*/
156156
public function _editAction()
157157
{
158-
$model = $this->_getModel();
159-
$id = $this->getRequest()->getParam('id');
160-
if (!$model->getId() && $id) {
161-
throw new Exception("Item is not longer exist.", 1);
162-
}
163-
164158
try {
159+
$model = $this->_getModel();
160+
$id = $this->getRequest()->getParam('id');
161+
if (!$model->getId() && $id) {
162+
// phpcs:disable
163+
throw new Exception("Item is not longer exist.", 1);
164+
// phpcs:disable
165+
}
166+
165167
$this->_getRegistry()->register('current_model', $model);
166168

167169
$this->_view->loadLayout();
@@ -311,12 +313,14 @@ public function _saveAction()
311313
*/
312314
protected function _duplicateAction()
313315
{
314-
$originModel = $this->_getModel();
315-
if (!$originModel->getId()) {
316-
throw new Exception("Item is not longer exist.", 1);
317-
}
318-
319316
try {
317+
$originModel = $this->_getModel();
318+
if (!$originModel->getId()) {
319+
// phpcs:disable
320+
throw new Exception("Item is not longer exist.", 1);
321+
// phpcs:disable
322+
}
323+
320324
$model = $originModel->duplicate();
321325

322326
$this->messageManager->addSuccess(__('%1 has been duplicated.', $model->getOwnTitle()));

0 commit comments

Comments
 (0)