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

#608: enhance error messages #653

Merged

Conversation

jan-vcapgemini
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini commented Sep 25, 2024

Fixes: #608

Implements:

  • reformatted process out and error messages
  • added test with expected Exception and error messages
  • performLogOnError will only be used on DEFAULT_CAPTURE
  • added Npm run test (disabled)
  • adjusted Dotnet run test (Windows only, does not work on CI)

@jan-vcapgemini jan-vcapgemini self-assigned this Sep 25, 2024
@hohwille
Copy link
Member

Sorry for interfering with PR #652. I am not sure if #608 is already fixed. I assume I only fixed it partially.
What if we have DEFAULT_CAPTURE combined with THROW_CLI?
IMHO then still the output would not be printed so we still need a small change for #652.

jan-vcapgemini and others added 2 commits September 27, 2024 12:27
# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java
@jan-vcapgemini
Copy link
Contributor Author

jan-vcapgemini commented Sep 30, 2024

I need to move logic of getout and getErr into ProcessResult.
And find getErr and GetOut loop in Eclipse which does the same and refactor too.

jan-vcapgemini and others added 14 commits October 4, 2024 12:35
refactored eclipse log method into ProcessResult
added log method to ProcessResult
optimized performLogOnError to use logger with proper log levels instead of custom messages
# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java
made sure that context runs on windows to detect dotnet.cmd properly
moved dotnet.cmd to windows folder
moved windows test to parameterized tests
added missing javadocs
fixed dotnet windows test script
renamed dotnet.cmd to dotnet.exe
fixed DotNet test
added run test to NpmTest
removed unused test resource files
renamed readme files to .gitkeep
made dotnet.exe executable
adjusted DotnetTest
adjusted NpmTest
disabled dotnet run tests on CI
disabled npm run test
@coveralls
Copy link
Collaborator

coveralls commented Oct 17, 2024

Pull Request Test Coverage Report for Build 11595805984

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 22 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.2%) to 66.915%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/process/ProcessResultImpl.java 1 93.1%
com/devonfw/tools/ide/tool/dotnet/DotNet.java 1 66.67%
com/devonfw/tools/ide/tool/eclipse/Eclipse.java 6 75.0%
com/devonfw/tools/ide/process/ProcessContextImpl.java 14 79.86%
Totals Coverage Status
Change from base Build 11580911301: 0.2%
Covered Lines: 6302
Relevant Lines: 9075

💛 - Coveralls

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jan-vcapgemini thanks for your PR. You covered the relevant spots and did some good improvements. 👍
However, some things here IMHO need some rework.
Further, ProcessContextTestImpl needs to be adopted since you now have added reasonable logging and you should remove the hack there to log the output again.

jan-vcapgemini and others added 2 commits October 21, 2024 13:38
removed SubLogger
moved throw of exceptions after logger
optimized out and err creation
removed level checks for logger
re-added logging of exitcode on proper log level
jan-vcapgemini and others added 3 commits October 24, 2024 17:08
removed duplicated log messages
removed ProcessResult.run hack
fixed and cleaned up tests
renamed ProcessConttextUnderTest
added new log method with 2 log levels to ProcessResult
@hohwille
Copy link
Member

There are tests revealing that something is still broken:

[ERROR] MvnTest.testMvnRun:69 Could not find log message equal to 'mvn foo bar' on level INFO
[ERROR] TomcatTest.testTomcat:50 Found expected log entries:
SUCCESS:Successfully installed java in version 8u402b06
The first entry that was not matching from a block of 10 expected log-entries was:
INFO:OpenJDK version 8u402b06

The message OpenJDK version 8u402b06 that is the output of the faked java --version is not logged anymore so the process output is somehow not logged here anymore. Probably we have the same problem with mvn where the test now also failed.

@hohwille hohwille mentioned this pull request Oct 29, 2024
@hohwille hohwille added this to the release:2024.11.001 milestone Oct 29, 2024
Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jan-vcapgemini thanks for completing this rather complicated and underestimated story 👍
Have a look at the remaining comments. Then we can merge. Great work 🥇

@hohwille hohwille merged commit 39d1434 into devonfw:main Oct 31, 2024
4 checks passed
@jan-vcapgemini jan-vcapgemini deleted the feature/608-enhance-error-messages branch November 4, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Enhance error messsages of ProcessBuilder
4 participants