This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,9 @@ func (r RichCLIMessage) String() string {
37
37
return str .String ()
38
38
}
39
39
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
-
50
40
// 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.
51
43
func Log (err error ) {
52
44
var cliErr RichCLIError
53
45
if ! xerrors .As (err , & cliErr ) {
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ coder envs --user charlie@coder.com ls -o json \
101
101
if err != nil {
102
102
atomic .AddInt32 (& fails , 1 )
103
103
clog .Log (err )
104
- return clog . Wrap ( err , "find env by name" )
104
+ return xerrors . Errorf ( "find env by name: %w" , err )
105
105
}
106
106
107
107
if err = client .StopEnvironment (cmd .Context (), env .ID ); err != nil {
You can’t perform that action at this time.
0 commit comments