Feature #49071
closedSchedulerTask: Rethrow exceptions in task execution
100%
Description
If a task throws an exception, TYPO3\CMS\Extbase\Scheduler\Task catch it, log it and returns false.
As the Scheduler TYPO3\CMS\Scheduler\Scheduler handles exceptions in executeTask and shows the message of the exception in the backend and handles writing to log hisself, Extbase shouldn't return false. As the Scheduler uses at atm $GLOBALS['BE_USER']->writelog() and not \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog() for logging, I would prefer to log self and rethrow the exception.
Would like to see this in 6.2 and 6.1.
Updated by Marc Bastian Heinrichs over 11 years ago
- Category set to Extbase
- Priority changed from Should have to Could have
- Target version set to Extbase 6.2
Updated by Alexander Opitz about 10 years ago
- Project changed from 534 to TYPO3 Core
- Category changed from Extbase to Extbase
- Target version changed from Extbase 6.2 to 7.0
Updated by Stephan Großberndt about 10 years ago
Since once again I had a hard time finding out why an Extbase CommandController failed:
As found out by Alexander, if a task throws an exception, TYPO3\CMS\Extbase\Scheduler\Task catches it, logs it and returns false.
Logging is only done if [SYS][systemLog] has a value set (file|mail|syslog|error_log) - which is not the case in a default installation - not even in development context!
So normally this information is just silently dropped, thus I would not consider this as a feature request but as a bug.
Logging to the systemLog is fine, but the information should be thrown again afterwards, otherwise the only message you will see when executing a Task with an error:
Execution of task "Extbase CommandController Task (extbase)" failed with the following message: Task failed to execute successfully. Class: TYPO3\CMS\Extbase\Scheduler\Task, UID: 3
Oh, really, it failed with the message "failed to execute"? Very helpful..
Using
throw $eafter logging to systemLog instead of
return FALSE;gives the reason of failure:
Execution of task "Extbase CommandController Task (extbase)" failed with the following message: PHP Warning: mssql_pconnect(): message: Cannot open user default database. Login failed. (severity 11) in xxx line 123
as well when executing the task manually from the BE-scheduler as in the BE-log when executed via cli_dispatch scheduler
Updated by Stephan Großberndt about 10 years ago
I tried to commit this as a change but I could not upload (maybe due to not having signed the CLA?).
If someone from the extbase team could commit this please?
[BUGFIX] Rethrow exceptions in task execution of SchedulerTask Rethrow exceptions from tasks inheriting from Extbase-SchedulerTask instead of just returning false. The logging in TYPO3\CMS\Extbase\Scheduler\Task happens only if [SYS][systemLog] has a value set (file|mail|syslog|error_log) - which is not the case in a default installation. So this information is just silently dropped at the moment. When returning false the unhelpful message in the BE log is "Task failed to execute successfully." Rethrowing the exception gives the reason of failure instead as well when executing the task manually from the BE-scheduler as in the BE-log when executed via cli_dispatch scheduler Resolves: #49071 Releases: master, 6.2
Updated by Mathias Schreiber almost 10 years ago
- Target version changed from 7.0 to 7.1 (Cleanup)
Updated by Gerrit Code Review almost 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36985
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36985
Updated by Gerrit Code Review almost 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36985
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37355
Updated by Mathias Brodala over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4ef3987fc1c08501fd886c4b7777dcdf53fa6fe3.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed