contributte / console

:boom: Best minimal console (symfony/console) to Nette Framework (@nette)
https://contributte.org/packages/contributte/console.html
MIT License
91 stars 32 forks source link

Set catchExceptions to false by default #68

Closed Rixafy closed 8 months ago

Rixafy commented 2 years ago

Default value for catchExceptions is inherited from symfony/console (true), it means that exception will be always caught by symfony/console and displayed as a red text in console and it won't be thrown again, so Tracy can't catch it and it won't be logged anywhere.

JanTvrdik commented 2 years ago

Are you should this will not break command exit code?

Rixafy commented 2 years ago

It will change the exit code from 1 to 255, only if that config parameter wasn't specified, but that would mean that any exception could not be logged, now it will be logged and exit code will be 255.

Rixafy commented 2 years ago

What if the default value wasn't false, but %debugMode%? Because I guess most people will have set it up this way anyway, since it causes no problems at all, when you are in debugMode, you can see the exceptions in the console, so for instance when you try migrations:diff and there is no changes, there will be an error message from doctrine in debugMode, but in production there will be only Tracy message that error has occured and it will be logged, possibly sent with monolog.

When we have false as a default value, then errors from production will be logged to tracy as they should, but on the other hand, when such silly error occurs in migrations diff command that there are no schema changes, it will not show itself to user, and therefore he must search for a log to find it, what is not very expected behavior.

It would be achievable via Expect::bool(!Debugger::$productionMode), since $productionMode is reversed $debugMode that goes into nette configurator.

f3l1x commented 8 months ago

I would stay with symfony default value.