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

feat: format error messages better (MINOR) #3233

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

agavra
Copy link
Contributor

@agavra agavra commented Aug 19, 2019

Description

Do some pretty printing and wrapping to make sure that error messages aren't an eye sore.

Testing done

Before:
image

After:
image

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@agavra agavra requested a review from a team as a code owner August 19, 2019 23:18
Copy link
Member

@spena spena left a comment

Choose a reason for hiding this comment

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

Seems we have two different output errors (JSON and non-JSON). I wonder why we don't keep one output for all errors? If we use JSON, shouldn't we always display JSON error messages so it is consistent?


// Then:
final String output = terminal.getOutputString();
if (console.getOutputFormat() == OutputFormat.TABULAR) {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be an assertion? What if we have a bug where the output format is not TABULAR? This test will never fail.

Copy link
Contributor Author

@agavra agavra Aug 20, 2019

Choose a reason for hiding this comment

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

JSON is for the REST API, tabular is what the CLI displays - I think we need both. This test doesn't make sense for the JSON case because we don't do anything special for it (it's testing formatting in the CLI).

w.r.t the assertion, this test class runs all the tests first in JSON, then in TABULAR

Copy link
Member

Choose a reason for hiding this comment

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

I see. I didn't notice this test is parameterized with JSON or TABULAR.


// Then:
final String output = terminal.getOutputString();
if (console.getOutputFormat() == OutputFormat.TABULAR) {
Copy link
Member

Choose a reason for hiding this comment

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

Same question as the previous one.

@spena spena requested a review from a team August 20, 2019 13:39
Copy link
Member

@spena spena left a comment

Choose a reason for hiding this comment

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

LGTM!

@agavra agavra merged commit c727d50 into confluentinc:master Aug 20, 2019
@agavra agavra deleted the error_msg branch August 20, 2019 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants