-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract does not offer correct return value on Exception #14
Comments
As you already digged into this: could you provide a patch/PR? |
Which solution would you prefer? Does the exit line here ever return any error codes (should the fix focus on this)? Or should I focus on catching exceptions here: |
i guess catching the exception and returning the correct exit code there might be the "right" way. All actions throw exceptions, if they don't succeed. However, to not confuse the next developer looking at https://github.com/etobi/Typo3ExtensionUtils/blob/master/lib/etobi/extensionUtils/Dispatcher.php#L91 |
I just double checked the actions. Seems like some actions do return TRUE/FALSE (like https://github.com/etobi/Typo3ExtensionUtils/blob/master/lib/etobi/extensionUtils/Controller/TerController.php#L125). I like to suggest to streamline the error handling (always throw an exception, instead of returning TRUE/FALSE) in all actions, implementing an "own Exception" (e.g. ActionFailedException extends \Exception) and catch that in the Dispatcher or t3xutils.php What do you think? |
That could work. It'll be awhile before I can dig into this again. |
Using "t3xutils.phar extract", the exit code is always 0, even if there was an exception.
The exit code is determined by $success when Dispatcher exits here: https://github.com/etobi/Typo3ExtensionUtils/blob/master/lib/etobi/extensionUtils/Dispatcher.php#L91
$status is supposed to be set in extractCommand with the return value of extractAction:
https://github.com/etobi/Typo3ExtensionUtils/blob/master/lib/etobi/extensionUtils/Dispatcher.php#L216
But, extractAction does not have a return value:
https://github.com/etobi/Typo3ExtensionUtils/blob/master/lib/etobi/extensionUtils/Controller/T3xController.php#L73
Also, the exception catcher does not exit with any error codes:
https://github.com/etobi/Typo3ExtensionUtils/blob/master/bin/t3xutils.php#L14
Either the extractAction needs to somehow return an appropriate boolean, or the exception catcher needs to exit with an error code.
The text was updated successfully, but these errors were encountered: