Bug #100871
closedCommon symfony command exceptions should not be thrown
100%
Description
With #99912, setCatchExceptions(false)
has been implemented to TYPO3\CMS\Core\Console\CommandApplication
, so that exceptions from symfony console are handled by TYPO3 exception handlers. That change made it possible to log CLI errors in TYPO3 logs, but after thinking more about the change, I see some downsides in #99912 as pointed out below:
- CLI now throws all symfony console exceptions, which does not look pretty
- Possible user errors (e.g. unknown command or invalid amount of arguments) are now logged to the TYPO3 log
Example: ./typo3/sysext/core/bin/typo3 site:show
Uncaught TYPO3 Exception Not enough arguments (missing: "identifier"). thrown in file /path/to/typo3/vendor/symfony/console/Input/Input.php in line 70
Also note, that #100059 fixes the described problem about the not registered listener in #99912. So it is now possible to register event listeners, who actually catch all CLI errors.
I'm currently not really sure, what is best to resolve the described downsides. We could either catch common/known symfony console exceptions and print the message in a "pretty" way or we could revert #99912 and implement an event listener for ConsoleErrorEvent
events, which logs those errors to the TYPO3 log.