pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
108 stars 46 forks source link

Provide handled execution of CLI commands so that error message is nicely visible on error output #562

Closed Bajger closed 1 year ago

Bajger commented 2 years ago

Describe the request Currently all execution of Pharo commands might end up with exception which might be domain specific or not. Error output is polluted with stack-trace information that isn't relevant for printing domain error.

Expected behavior All domain errors should be printed in nice way (without any stack trace visible). All non-domain errors will print stack trace. Exit code should return 1 in both cases (exitFailure).

Expected development cost Instead of sending top-level execute method on super class of CLI commands, implement new executeHandled that will:

Screenshots This is example how domain error ends up. It should print just red line (that is relevant). image

Additional context ...

Bajger commented 1 year ago

Working on this right now. There is just one PhLCliCommand>>execute that catches all business exceptions. It calls basicExecute where raising business exceptions are allowed.

Bajger commented 1 year ago

Solution here: https://github.com/pharo-project/pharo-launcher/pull/575/commits/9a25160896f45403ed8d5e7ff44b75fffba2ea73#diff-1a6049d3220a5b2319d7d16f035361bb3ec7f52b284455e7e9769f6b2ba76e6e