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

Function GetErrorCode

pkg/utilds/codederror.go:40–49  ·  view source on GitHub ↗

GetErrorCode extracts the error code from anywhere in the error chain. Returns empty string if no CodedError is found.

(err error)

Source from the content-addressed store, hash-verified

38// GetErrorCode extracts the error code from anywhere in the error chain.
39// Returns empty string if no CodedError is found.
40func GetErrorCode(err error) string {
41 if err == nil {
42 return ""
43 }
44 var coded CodedError
45 if errors.As(err, &coded) {
46 return coded.Code
47 }
48 return ""
49}
50
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.

Callers 1

ClassifyConnErrorFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected