Content-Length: 279238 | pFad | https://github.com/coder/coder/commit/a7f0dba4c3d0c523f686c1d985537fa86787a58d

87 fix(cli): handle nil unwrap errors when formatting (cherry-pick #1809… · coder/coder@a7f0dba · GitHub
Skip to content

Commit a7f0dba

Browse files
fix(cli): handle nil unwrap errors when formatting (cherry-pick #18099) (#18821)
Co-authored-by: Ethan <39577870+ethanndickson@users.noreply.github.com>
1 parent 049feec commit a7f0dba

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cli/root.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,11 +1060,12 @@ func cliHumanFormatError(from string, err error, opts *formatOpts) (string, bool
10601060
return formatRunCommandError(cmdErr, opts), true
10611061
}
10621062

1063-
uw, ok := err.(interface{ Unwrap() error })
1064-
if ok {
1065-
msg, special := cliHumanFormatError(from+traceError(err), uw.Unwrap(), opts)
1066-
if special {
1067-
return msg, special
1063+
if uw, ok := err.(interface{ Unwrap() error }); ok {
1064+
if unwrapped := uw.Unwrap(); unwrapped != nil {
1065+
msg, special := cliHumanFormatError(from+traceError(err), unwrapped, opts)
1066+
if special {
1067+
return msg, special
1068+
}
10681069
}
10691070
}
10701071
// If we got here, that means that the wrapped error chain does not have

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/coder/coder/commit/a7f0dba4c3d0c523f686c1d985537fa86787a58d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy