MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / IsConnError

Function IsConnError

internal/rpc/rpc_utils.go:37–54  ·  view source on GitHub ↗

IsConnError 是否为连接错误

(err error)

Source from the content-addressed store, hash-verified

35
36// IsConnError 是否为连接错误
37func IsConnError(err error) bool {
38 if err == nil {
39 return false
40 }
41
42 // 检查是否为连接错误
43 statusErr, ok := status.FromError(err)
44 if ok {
45 var errorCode = statusErr.Code()
46 return errorCode == codes.Unavailable || errorCode == codes.Canceled
47 }
48
49 if strings.Contains(err.Error(), "code = Canceled") {
50 return true
51 }
52
53 return false
54}

Callers 15

ErrorObjectFunction · 0.92
StartMethod · 0.92
StartMethod · 0.92
StartMethod · 0.92
fetchMethod · 0.92
updateMethod · 0.92
LoopMethod · 0.92
StartMethod · 0.92
StartMethod · 0.92
StartMethod · 0.92
loopTasksMethod · 0.92
finishTaskMethod · 0.92

Calls 3

CodeMethod · 0.65
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected