Skip to content

chore: handle errors in wsproxy server for cli using buildinfo #11584

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

Merged
merged 11 commits into from
Jan 11, 2024
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
Next Next commit
always print traec
  • Loading branch information
Emyrk committed Jan 11, 2024
commit 2ac5c176f127b5eb31f0506c97ab5c96a7db36e7
12 changes: 4 additions & 8 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,7 @@ func formatMultiError(from string, multi []error, opts *formatOpts) string {

// Write errors out
var str strings.Builder
var traceMsg string
if opts.Verbose {
traceMsg = fmt.Sprintf("Trace=[%s])", 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 @@ -1160,11 +1157,10 @@ func formatCoderSDKError(from string, err *codersdk.Error, opts *formatOpts) str
if opts.Verbose {
_, _ = str.WriteString(pretty.Sprint(headLineStyle(), fmt.Sprintf("API request error to \"%s:%s\". Status code %d", err.Method(), err.URL(), err.StatusCode())))
_, _ = str.WriteString("\n")
if from != "" {
_, _ = str.WriteString(pretty.Sprint(headLineStyle(), fmt.Sprintf("Trace=[%s]", from)))
_, _ = str.WriteString("\n")
}
}
// Always include this trace. Users can ignore this.
_, _ = 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