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
Show file tree
Hide file tree
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
linting
  • Loading branch information
Emyrk committed Jan 11, 2024
commit 4066e2c670110e3e5098a0f2e687a5bf32ca186c
1 change: 0 additions & 1 deletion cli/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (RootCmd) errorExample() *clibase.Cmd {
xerrors.Errorf("first error: %w", errorWithStackTrace()),
xerrors.Errorf("second error: %w", errorWithStackTrace()),
)

},
},

Expand Down
2 changes: 2 additions & 0 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,8 @@ func formatCoderSDKError(from string, err *codersdk.Error, opts *formatOpts) str
// commands. When we pretty print errors, we lose the context in which they came.
// This function adds the context back. Unfortunately there is no easy way to get
// the prefix to: "error string: %w", so we do a bit of string manipulation.
//
//nolint:errorlint
func traceError(err error) string {
if uw, ok := err.(interface{ Unwrap() error }); ok {
a, b := err.Error(), uw.Unwrap().Error()
Expand Down
2 changes: 1 addition & 1 deletion codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error) {
}
defer res.Body.Close()

if res.StatusCode != http.StatusBadRequest || ExpectJSONMime(res) != nil {
if res.StatusCode != http.StatusOK || ExpectJSONMime(res) != nil {
return BuildInfoResponse{}, ReadBodyAsError(res)
}

Expand Down