mirror of
https://github.com/coder/coder.git
synced 2026-10-28 02:42:54 +08:00
chore: handle errors in wsproxy server for cli using buildinfo (#11584)
Cli errors are pretty formatted. This handles nested pretty types. Before it found the first error it could understand and return that. Now it will print the full error stack with more information. To prevent information loss, a "[Trace=...]" was added to capture some extra error context for debugging.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -157,7 +158,10 @@ func New(ctx context.Context, opts *Options) (*Server, error) {
|
||||
// TODO: Probably do some version checking here
|
||||
info, err := client.SDKClient.BuildInfo(ctx)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to fetch build info from %q: %w", opts.DashboardURL, err)
|
||||
return nil, fmt.Errorf("buildinfo: %w", errors.Join(
|
||||
fmt.Errorf("unable to fetch build info from primary coderd. Are you sure %q is a coderd instance?", opts.DashboardURL),
|
||||
err,
|
||||
))
|
||||
}
|
||||
if info.WorkspaceProxy {
|
||||
return nil, xerrors.Errorf("%q is a workspace proxy, not a primary coderd instance", opts.DashboardURL)
|
||||
|
||||
Reference in New Issue
Block a user