Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
conditional, do not print empty string
  • Loading branch information
Emyrk committed Jan 11, 2024
commit d754fd8a30e566dc21ed8ac34647b51a2265ad66
11 changes: 8 additions & 3 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,10 @@ func formatMultiError(from string, multi []error, opts *formatOpts) string {

// Write errors out
var str strings.Builder
traceMsg := fmt.Sprintf("Trace=[%s])", from)
var traceMsg string
if from != "" {
traceMsg = fmt.Sprintf("Trace=[%s])", from)
}
_, _ = str.WriteString(pretty.Sprint(headLineStyle(), fmt.Sprintf("%d errors encountered: %s", len(multi), traceMsg)))
for i, errStr := range errorStrings {
// Indent each error
Expand Down Expand Up @@ -1159,8 +1162,10 @@ func formatCoderSDKError(from string, err *codersdk.Error, opts *formatOpts) str
_, _ = str.WriteString("\n")
}
// Always include this trace. Users can ignore this.
_, _ = str.WriteString(pretty.Sprint(headLineStyle(), fmt.Sprintf("Trace=[%s]", from)))
_, _ = str.WriteString("\n")
if from != "" {
_, _ = str.WriteString(pretty.Sprint(headLineStyle(), fmt.Sprintf("Trace=[%s]", from)))
_, _ = str.WriteString("\n")
}

_, _ = str.WriteString(pretty.Sprint(headLineStyle(), err.Message))
if err.Helper != "" {
Expand Down