-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[9.x] Makes ExceptionHandler::renderForConsole
internal
#40936
Conversation
okay, so how do you do it then?! How do you catch exceptions thrown within commands, there must be a way, other than wrapping every command runner in a try..catch?! Why isn't this in the error reporting documentation? when you search for anything relating to "catch errors in commands in laravel", you get old articles telling you to overwrite the renderForConsole, and no official documentation from Laravel on how to achieve the same thing. This isn't good, if there is a solution perhaps you would point me to it, so that I can update the forum posts that are giving out of date information? |
@kieransimkin Because we use GitHub hooks, issues get automatically closed once we merged the pull request that solves a particular issue. To catch exceptions from the console, you may use the Of course, you may use |
My App's report function doesn't get called when an exception happens in console. |
* | ||
* @internal This method is not meant to be used or overwritten outside the framework. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR marks a method internal which is part of an interface?
class Handler implements ExceptionHandlerContract
->
framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php
Lines 38 to 45 in 05b785d
/** | |
* Render an exception to the console. | |
* | |
* @param \Symfony\Component\Console\Output\OutputInterface $output | |
* @param \Throwable $e | |
* @return void | |
*/ | |
public function renderForConsole($output, Throwable $e); |
This pull request makes the
ExceptionHandler::renderForConsole
internal. For years, Collision overrides the method with its own logic, and as consequence,App\Exceptions\ExceptionHandler::renderForConsole
never gets called.Adding the flag
@internal
will instruct people that this method is not meant to be overwritten.Closes #40935.