MCPcopy Create free account
hub / github.com/gorilla/websocket / IsCloseError

Function IsCloseError

conn.go:151–160  ·  view source on GitHub ↗

IsCloseError returns boolean indicating whether the error is a *CloseError with one of the specified codes.

(err error, codes ...int)

Source from the content-addressed store, hash-verified

149// IsCloseError returns boolean indicating whether the error is a *CloseError
150// with one of the specified codes.
151func IsCloseError(err error, codes ...int) bool {
152 if e, ok := err.(*CloseError); ok {
153 for _, code := range codes {
154 if e.Code == code {
155 return true
156 }
157 }
158 }
159 return false
160}
161
162// IsUnexpectedCloseError returns boolean indicating whether the error is a
163// *CloseError with a code not in the list of expected codes.

Callers 1

TestCloseErrorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCloseErrorFunction · 0.68