diff --git a/cli/cmd/deploy.go b/cli/cmd/deploy.go index 93047978b7..ec3cc55d83 100644 --- a/cli/cmd/deploy.go +++ b/cli/cmd/deploy.go @@ -264,7 +264,20 @@ func mergeResultMessages(results []schema.DeployResult) string { } } - return strings.Join(okMessages, "\n") + "\n\n" + strings.Join(errMessages, "\n") + output := "" + + if len(okMessages) > 0 { + output += strings.Join(okMessages, "\n") + if len(errMessages) > 0 { + output += "\n\n" + } + } + + if len(errMessages) > 0 { + output += strings.Join(errMessages, "\n") + } + + return output } func didAllResultsError(results []schema.DeployResult) bool { diff --git a/pkg/lib/errors/message.go b/pkg/lib/errors/message.go index 77c1637c26..f9b483fbaa 100644 --- a/pkg/lib/errors/message.go +++ b/pkg/lib/errors/message.go @@ -25,16 +25,16 @@ import ( ) func PrintError(err error, strs ...string) { - fmt.Println(errorStr(err, strs...)) + fmt.Println(ErrorStr(err, strs...)) // PrintStacktrace(err) } func PrintErrorForUser(err error, strs ...string) { - print.BoldFirstLine(errorStr(err, strs...)) + print.BoldFirstLine(ErrorStr(err, strs...)) // PrintStacktrace(err) } -func errorStr(err error, strs ...string) string { +func ErrorStr(err error, strs ...string) string { wrappedErr := Wrap(err, strs...) return "error: " + strings.TrimSpace(Message(wrappedErr)) } diff --git a/pkg/operator/resources/resources.go b/pkg/operator/resources/resources.go index 97dd73b24d..8e219ee114 100644 --- a/pkg/operator/resources/resources.go +++ b/pkg/operator/resources/resources.go @@ -115,7 +115,7 @@ func Deploy(projectBytes []byte, configFileName string, configBytes []byte, forc api, msg, err := UpdateAPI(&apiConfig, projectID, force) results[i].Message = msg if err != nil { - results[i].Error = errors.Message(err) + results[i].Error = errors.ErrorStr(err) } else { results[i].API = api }