User tests: Successful: Unsuccessful:
Pull Request for Issue #31984 .
handled exception from CLI
Install Joomla 4 perfectly.
Edit /configuration.php and change your database host to an invalid value, while there check debug=false and error_reporting = none (it would have been default).
Now run php cli/joomla.php
Exception is caught and rendered nicely with the message "Could not connect to database: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known""
Expect no stack trace
Expect no debug information
Status | New | ⇒ | Pending |
Category | ⇒ | CLI |
Labels |
Added:
?
|
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
I get error handling is hard for some of y’all, but this is just a garbage hack that makes debugging errors next to impossible, might as well just print “LOLZ IT BROKE”.
Don’t merge this mess, do it right. Overload the exception handling of the console application’s execute method and tweak it to do whatever you want. There is a reason exception handling is done inside the application and not left to be handled in front controllers or entry point files, you have the entire app framework at your disposal inside the app (which, BTW, with the default application workflow means someone can add meaningful exception logging and dispatch events that can be subscribed to which allows add-on integrations to do something meaningful with errors; shocking, I know, who woulda thought you could allow add-one to do useful things in an application intended to be extended with add-one) whereas with this patch you have no way of debugging because the entire exception is swallowed.
Also, generally if there’s an uncaught exception in the exception handling layer, you typically want a noisy output in the CLI integration, as that generally means something is catastrophically broken and needs attention 10 minutes ago. This patch silences that with zero gain.
@mtbraoblkler if you are fully right then simply submit a PR....
@brianteeman no i don't know... but doesn't matter
Unfortunately @mtbraoblkler is correct. This should be overloaded in our ConsoleApplication. I think https://github.com/joomla-framework/console/blob/master/src/Application.php#L914-L943 is the method you want to duplicate in the CMS ConsoleApplication class
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-02-01 20:56:59 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
I have tested this item✅ successfully on 5a02415
Tested successfully in Beta7-dev of 19 January using PHP 8.0.1.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32082.