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

Defer formatting when only one error is returned #33

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

Conversation

mkatychev
Copy link

@mkatychev mkatychev commented Dec 18, 2019

  • Testing for 1 error in unit tests and emitting only one error makes the \n\t* prepend impractical and noisy.

  • There should be no need to do any multiple error logic until more than one error is present.

  • When multierror.Error.Error() is called with len(multierror.Error.Errors) == 1, the formatting should be deferred (gracefully decompose) to the one and only error present: multierror.Error[0].Error()

@hashicorp-cla
Copy link

hashicorp-cla commented Dec 18, 2019

CLA assistant check
All committers have signed the CLA.

@mkatychev mkatychev changed the title Remove multierror formatting when only one error is returned Defer formatting when only one error is returned Dec 18, 2019
Copy link

@drmaples drmaples left a comment

Choose a reason for hiding this comment

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

this looks great

@jefferai
Copy link
Member

Just a note that while I would also like this behavior, it changes the output of the library and thus may break any code depending on the output to be stable. As a result, I doubt we will end up accepting it at this time unless we want to consider a major rev bump. Pinging @mitchellh for opinions.

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.

None yet

4 participants