-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Display file and line on Exception #21414
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
Conversation
IMHO having only the clean exception message when not in verbose mode is good enough... just set the verbose mode if you need more.
I think it's useless to have the exception log in stderr since the ran command already writes the proper message into so it's just having two traces for the same error, which doesn't make sense to me. I just proposed to fix that in symfony/symfony-standard#1044. |
I'm sympathetic to the intend here. I also felt bad with just the message several times. |
My opinion is the opposite of Nico and it aligns with Robin's comments :) Symfony errors have always been human-friendly and to get the full machine-friendly details, you must add Most of you will disagree with me ... but not only I'd not add the file+line, but I'd also remove the weird exception class name in the error blocks. |
But CLI apps are not like Web ones: you can wait several minutes, and get the exception. |
I too could have used this on multiple occasions with long-running processes. |
I understand the intention too, but I still think that verbose mode should be used for that (especially in a cron), anyway console errors are now logged and you can configure the console handler for having them in stderr if wanted. If I want more to be displayed, then I would prefer writing my own exception class or any console helper and tweak the message into (maybe could we provide such in the console?) instead of expecting the application to do it automatically. |
I'm also against this change. Verbose modes are indeed the right way to get more information about errors. It's annoying when you run (as a user) a command and you get a stack trace displayed. That's the same when browsing the web and getting an exception message. Sure, on the CLI, it cannot be exploited like for the web, but that's not user friendly. So, I'm 👎 |
Closing as discussed, thanks for the PR anyway! |
I'm reopening because I'm just wasting my time debugging transient errors, just because the console displays useless errors. all I get is e.g. a terse
Alternatively, we could have an env var to control verbosity... But we cannot say all is fine as is. Please hint a direction that would solve the DX issue and be OK to you. |
Note that the worst error I got in this context is (when playing with Flex+SF4):
which is just garbage as an error message, I have no idea where this can be in the code base. |
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.
👍 for the new output. What I'm against is having a message looking like a trace in the output for any exception thrown in low verbosity. I will check the output of command registration errors in FWB after this, having the file+line for each error displayed through the multiple calls to doRenderException
is probably not useful.
Do we really need the exception class on the message? Now that we have the exact file and line, that's probably a detail people don't need to care about, right? |
I agree that the FQCN does not seem useful anymore. |
Exception class now removed in non-verbose modes, see fixtures. |
Thanks @arno14 and @nicolas-grekas |
This PR was merged into the 3.4 branch. Discussion ---------- [Console] Display file and line on Exception | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes/no | Fixed tickets | - | License | MIT | Doc PR | - When an exception occured: If you have not set a verbose mode when running the command, you don't have information about the file and the line on which the exception occured. So you must run a second time the command but the exception may not occured this time (if based on some databases datas which have changed) and it's a waste of time if you process is very long and the exception occured at the end. The feature #21003 solve the problem if you are in a standard Symfony edition, if you leave the default settings and if you are in dev mode Commits ------- 484d278 [Console] Display file and line on Exception
…mon console exceptions (yceruto) This PR was merged into the 3.4 branch. Discussion ---------- [Console] Do not display short exception trace for common console exceptions | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | -  I'd like reconsider [the new error output][1] with short exception trace always displayed at top, IMHO it's annoying for common exceptions (there is not real debugging reason, the message is clear enough) such as `Symfony\Component\Console\Exception\*` which have an impact into current CLI applications. However, I'm proposing display it for unexpected exceptions or if verbosity is enabled:  Note @nicolas-grekas's #21414 (comment) is still covered. [1]: #21414 Commits ------- 47b1106 Do not display short exception trace for built-in console exceptions
When an exception occured:
If you have not set a verbose mode when running the command, you don't have information about the file and the line on which the exception occured.
So you must run a second time the command but the exception may not occured this time (if based on some databases datas which have changed) and it's a waste of time if you process is very long and the exception occured at the end.
The feature #21003 solve the problem if you are in a standard Symfony edition, if you leave the default settings and if you are in dev mode