Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit be8a73a

Browse files
committed
fixup! Migrate more logs to clog
1 parent bbfdbdd commit be8a73a

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

internal/clog/error.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,9 @@ func (r RichCLIMessage) String() string {
3737
return str.String()
3838
}
3939

40-
// Wrap wraps the underling error, but does not add context IF a downstream
41-
// error is a RichCLIError. The original human-readable message is retained.
42-
func Wrap(err error, msg string) error {
43-
var cliError RichCLIError
44-
if xerrors.As(err, &cliError) {
45-
return xerrors.Errorf("%s: %w", msg, cliError.error)
46-
}
47-
return xerrors.Errorf("%s: %w", msg, err)
48-
}
49-
5040
// Log logs the given error to stderr, defaulting to "fatal" if the error is not a RichCLIError.
41+
// If the error is a RichCLIError, the plain error chain is ignored and the rich error
42+
// is logged on its own.
5143
func Log(err error) {
5244
var cliErr RichCLIError
5345
if !xerrors.As(err, &cliErr) {

internal/cmd/envs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ coder envs --user charlie@coder.com ls -o json \
101101
if err != nil {
102102
atomic.AddInt32(&fails, 1)
103103
clog.Log(err)
104-
return clog.Wrap(err, "find env by name")
104+
return xerrors.Errorf("find env by name: %w", err)
105105
}
106106

107107
if err = client.StopEnvironment(cmd.Context(), env.ID); err != nil {

0 commit comments

Comments
 (0)