fix multierror merge

This commit is contained in:
Alex Dadgar
2017-09-13 21:48:52 -07:00
parent 3777592079
commit a88ce5439d

View File

@@ -18,10 +18,6 @@ import (
// MergeMultierrorWarnings takes job warnings and canonicalize warnings and
// merges them into a returnable string. Both the errors may be nil.
func MergeMultierrorWarnings(warnings ...error) string {
if len(warnings) == 0 {
return ""
}
var warningMsg multierror.Error
for _, warn := range warnings {
if warn != nil {
@@ -29,6 +25,10 @@ func MergeMultierrorWarnings(warnings ...error) string {
}
}
if len(warningMsg.Errors) == 0 {
return ""
}
// Set the formatter
warningMsg.ErrorFormat = warningsFormatter
return warningMsg.Error()