Skip to content
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

prevent stacktrace of CliException even with debug logging #933

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hohwille
Copy link
Member

@hohwille hohwille commented Jan 14, 2025

With debug enabled (--debug or --trace) we get stacktraces of CliExceptions including CliAbortException or CliExitException that may confused end-users and cause pointless bug issues being created.
Developers that want to debug IDEasy can run it from their IDE and set breakpoints instead.

Current behaviour:

$ ideasy -d env
Running commandlet EnvironmentCommandlet[env]
Step 'ide' ended with failure.

com.devonfw.tools.ide.cli.CliExitException:
        at com.devonfw.tools.ide.commandlet.EnvironmentCommandlet.run(EnvironmentCommandlet.java:58)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:875)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:805)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

Expected behaviour:

$ ideasy -d env
Running commandlet EnvironmentCommandlet[env]
Step 'ide' ended with failure.

@hohwille hohwille added enhancement New feature or request CLI IDEasy command-line-interface (parsing args, etc.) logging labels Jan 14, 2025
@hohwille hohwille added this to the release:2025.01.001 milestone Jan 14, 2025
@hohwille hohwille self-assigned this Jan 14, 2025
@coveralls
Copy link
Collaborator

coveralls commented Jan 14, 2025

Pull Request Test Coverage Report for Build 12815331100

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 16 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.3%) to 68.489%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/cli/Ideasy.java 16 55.88%
Totals Coverage Status
Change from base Build 12814712583: 0.3%
Covered Lines: 7062
Relevant Lines: 9938

💛 - Coveralls

@hohwille
Copy link
Member Author

I am not getting it:

Coverage decreased (-1.2%) to 66.655%

I removed and simplified code.
Is this a rounding problem that hit me here?
Kind of stupid but seems that I need to add some (random) test to improve coverage and being able to merge.

@hohwille
Copy link
Member Author

The class Ideasy had 0% coverage.
Since I was forced to add a test, I could cover all lines and 50% branch coverage.
This way I also improved the log assertions what seems helpful.
Especially this way I also found the reason why we print an empty line when the bash gets initialized with ide command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI IDEasy command-line-interface (parsing args, etc.) enhancement New feature or request logging
Projects
Status: Team Review
Development

Successfully merging this pull request may close these issues.

2 participants