MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / GetErrorSubCode

Function GetErrorSubCode

pkg/utilds/codederror.go:53–62  ·  view source on GitHub ↗

GetErrorSubCode extracts the error subcode from anywhere in the error chain. Returns empty string if no CodedError is found or if SubCode is not set.

(err error)

Source from the content-addressed store, hash-verified

51// GetErrorSubCode extracts the error subcode from anywhere in the error chain.
52// Returns empty string if no CodedError is found or if SubCode is not set.
53func GetErrorSubCode(err error) string {
54 if err == nil {
55 return ""
56 }
57 var coded CodedError
58 if errors.As(err, &coded) {
59 return coded.SubCode
60 }
61 return ""
62}
63
64// Errorf creates a formatted error wrapped in a CodedError.
65// This is a convenience function that combines fmt.Errorf with MakeCodedError.

Callers 1

ClassifyConnErrorFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected