@@ -15,29 +15,23 @@ class Delete extends \Magento\Theme\Controller\Adminhtml\System\Design\Theme
15
15
*/
16
16
public function execute ()
17
17
{
18
- $ redirectBack = (bool )$ this ->getRequest ()->getParam ('back ' , false );
19
18
$ themeId = $ this ->getRequest ()->getParam ('id ' );
20
- try {
21
- if ($ themeId ) {
22
- /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
23
- $ theme = $ this ->_objectManager ->create ('Magento\Framework\View\Design\ThemeInterface ' )->load ($ themeId );
24
- if (!$ theme ->getId ()) {
25
- throw new \InvalidArgumentException (sprintf ('We cannot find a theme with id "%1". ' , $ themeId ));
26
- }
27
- if (!$ theme ->isVirtual ()) {
28
- throw new \InvalidArgumentException (
29
- sprintf ('Only virtual theme is possible to delete and theme "%s" isn \'t virtual ' , $ themeId )
30
- );
31
- }
32
- $ theme ->delete ();
33
- $ this ->messageManager ->addSuccess (__ ('You deleted the theme. ' ));
19
+ if ($ themeId ) {
20
+ /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
21
+ $ theme = $ this ->_objectManager ->create ('Magento\Framework\View\Design\ThemeInterface ' )->load ($ themeId );
22
+ if (!$ theme ->getId ()) {
23
+ throw new \InvalidArgumentException (sprintf ('We cannot find a theme with id "%1". ' , $ themeId ));
24
+ }
25
+ if (!$ theme ->isVirtual ()) {
26
+ throw new \InvalidArgumentException (
27
+ sprintf ('Only virtual theme is possible to delete and theme "%s" isn \'t virtual ' , $ themeId )
28
+ );
34
29
}
35
- } catch (\Magento \Framework \Exception \LocalizedException $ e ) {
36
- $ this ->messageManager ->addError ($ e ->getMessage ());
37
- } catch (\Exception $ e ) {
38
- $ this ->messageManager ->addException ($ e , __ ('We cannot delete the theme. ' ));
39
- $ this ->_objectManager ->get ('Psr\Log\LoggerInterface ' )->critical ($ e );
30
+ $ theme ->delete ();
31
+ $ this ->messageManager ->addSuccess (__ ('You deleted the theme. ' ));
40
32
}
33
+
34
+ $ redirectBack = (bool )$ this ->getRequest ()->getParam ('back ' , false );
41
35
/**
42
36
* @todo Temporary solution. Theme module should not know about the existence of editor module.
43
37
*/
0 commit comments