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

Format nested multi-line errors neatly #30

Closed
wants to merge 1 commit into from
Closed

Format nested multi-line errors neatly #30

wants to merge 1 commit into from

Conversation

mentalisttraceur
Copy link

@mentalisttraceur mentalisttraceur commented Dec 16, 2019

This makes the default formatter function robust against errors which have nested \n characters.

The overwhelmingly common case where an error is just one line is unaffected, so I presume this is backwards compatible in all cases where the current behavior is correct and desired.

I think this belongs in the default formatter rather than users having to plug it in because without this, any code that gives you an error in string form might have already "smudged" error information into ambiguous or hard-to-read form if that code used multierror and didn't proactively defend against the possibility of multi-line errors.

@mentalisttraceur
Copy link
Author

Also, once this is in place, people like @bits01 and me who have use cases for non-flattened nested multierrors will have a much nicer time implementing that.

Namely, the need to the user to hackishly call multierror.Prefix (see #5 ) goes away.

@mentalisttraceur mentalisttraceur changed the title Format multi-line errors neatly Format nested multi-line errors neatly Dec 17, 2019
@claire-labry claire-labry deleted the branch hashicorp:master April 6, 2023 18:41
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

2 participants