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

Improve CLI error messages #3078

Merged
merged 4 commits into from Jul 28, 2022
Merged

Improve CLI error messages #3078

merged 4 commits into from Jul 28, 2022

Conversation

nvoxland
Copy link
Contributor

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Currently the CLI attempts to figure out the "best" message to show from all the different "caused by" reasons in an uncaught exception and sends that to the UI as the error message. Example:

Unexpected error running Liquibase: liquibase.parser.core.ParsedNodeException: Unknown precondition 'invalid'. Check for spelling or capitalization errors and missing extensions such as liquibase-commercial.

It picks the message to show by finding the "lowest" caused by. But, there can be valuable information in a variety of the caused by sections, and just because an exception is lowest doesn't mean it's the most useful.

This changes the CLI message to include all the messages in the stacktrace. Example:

Unexpected error running Liquibase: Connection could not be created to jdbc:mysql://localhost:33063/lbcat with driver 
  - Caused by: Connection refused: connect

Things to be aware of

  • Improved the logic to remove the exception class names from the UI error message
  • Added code to removed duplicate messages that sometimes appear in the exceptions
  • Only impacts the CLI

Things to worry about

  • Nothing

@github-actions
Copy link

github-actions bot commented Jul 19, 2022

Unit Test Results

  4 608 files  ±  0    4 608 suites  ±0   34m 30s ⏱️ -40s
  4 600 tests +  7    4 386 ✔️ +11     214 💤  - 4  0 ±0 
54 372 runs  +84  49 364 ✔️ +88  5 008 💤  - 4  0 ±0 

Results for commit 3de09e3. ± Comparison against base commit 97b474b.

♻️ This comment has been updated with latest results.

…essage

# Conflicts:
#	liquibase-cli/src/main/java/liquibase/integration/commandline/LiquibaseLauncher.java
# Conflicts:
#	liquibase-cli/src/main/java/liquibase/integration/commandline/LiquibaseLauncher.java
@FBurguer FBurguer self-assigned this Jul 28, 2022
@FBurguer
Copy link

Cases like conecttion error and invalid precondition are more clear now and error msgs that dont have Caused by doesnt seem to be impacted.

@nvoxland nvoxland merged commit 16337ee into master Jul 28, 2022
Conditioning++ automation moved this from To Do to Done Jul 28, 2022
@nvoxland nvoxland deleted the improve-cli-error-message branch July 28, 2022 15:41
@kataggart kataggart added this to the NEXT milestone Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants