Project

General

Profile

Actions

Bug #100871

closed

Common symfony command exceptions should not be thrown

Added by Torben Hansen over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2023-05-13
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99912: ProductionExceptionHandler does not handle CLI ExceptionsClosed2023-02-09

Actions
Actions

Also available in: Atom PDF