Repository navigation
[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.
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

This pull request makes the
ExceptionHandler::renderForConsoleinternal. For years, Collision overrides the method with its own logic, and as consequence,App\Exceptions\ExceptionHandler::renderForConsolenever gets called.Adding the flag
@internalwill instruct people that this method is not meant to be overwritten.Closes #40935.