[BUGFIX] Scheduler: Show exception when invalid CommandController present 18/36718/2
authorArmin Ruediger Vieweg <armin@v.ieweg.de>
Tue, 3 Feb 2015 19:43:44 +0000 (20:43 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 12 Feb 2015 16:55:16 +0000 (17:55 +0100)
When a CommandController in an extbase extension has been registered,
but the class does not contain the string "CommandController"
an exception will be thrown. Before this patch, this exception
will never show up.

This patch adds the output of exception's message in Scheduler module,
which gives the developer a hint why the "add new task" form is not
displayed properly.

Also it extends the exception with description why the class name is invalid.

Resolves: #64836
Releases: master, 6.2
Change-Id: I309ed02c7fd4597b99388518abf842e600b27a9a
Reviewed-on: http://review.typo3.org/36718
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php

index 0b83e53..7e04f39 100644 (file)
@@ -79,7 +79,10 @@ class Command {
                        $classNameParts = array_values($classNameParts);
                }
                if (count($classNameParts) !== 4 || strpos($classNameParts[3], 'CommandController') === FALSE) {
-                       throw new \InvalidArgumentException('Invalid controller class name "' . $controllerClassName . '"', 1305100019);
+                       throw new \InvalidArgumentException(
+                               'Invalid controller class name "' . $controllerClassName . '". Class name must end with "CommandController".',
+                               1305100019
+                       );
                }
                $this->extensionName = $classNameParts[1];
                $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
index 6d9fb2e..e1c5b53 100644 (file)
@@ -199,7 +199,11 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                                        $content .= $this->editTask();
                                                        $sectionTitle = $GLOBALS['LANG']->getLL('action.' . $this->CMD);
                                                } catch (\Exception $e) {
-                                                       // An exception may happen when the task to
+                                                       if ($e->getCode() === 1305100019) {
+                                                               // Invalid controller class name exception
+                                                               $this->addMessage($e->getMessage(), FlashMessage::ERROR);
+                                                       }
+                                                       // An exception may also happen when the task to
                                                        // edit could not be found. In this case revert
                                                        // to displaying the list of tasks
                                                        // It can also happen when attempting to edit a running task