Improve kubeadm apply error logging style

This commit is contained in:
wackxu
2017-11-20 10:50:09 +08:00
parent 6b97376a53
commit 3592c1be18
3 changed files with 43 additions and 3 deletions

View File

@@ -75,3 +75,12 @@ func checkErr(prefix string, err error, handleErr func(string, int)) {
handleErr(err.Error(), DefaultErrorExitCode)
}
}
// FormatErrMsg returns a human-readable string describing the slice of errors passed to the function
func FormatErrMsg(errs []error) string {
var errMsg string
for _, err := range errs {
errMsg = fmt.Sprintf("%s\t-%s\n", errMsg, err.Error())
}
return errMsg
}