MCPcopy
hub / github.com/gorilla/websocket / IsUnexpectedCloseError

Function IsUnexpectedCloseError

conn.go:164–174  ·  view source on GitHub ↗

IsUnexpectedCloseError returns boolean indicating whether the error is a *CloseError with a code not in the list of expected codes.

(err error, expectedCodes ...int)

Source from the content-addressed store, hash-verified

162// IsUnexpectedCloseError returns boolean indicating whether the error is a
163// *CloseError with a code not in the list of expected codes.
164func IsUnexpectedCloseError(err error, expectedCodes ...int) bool {
165 if e, ok := err.(*CloseError); ok {
166 for _, code := range expectedCodes {
167 if e.Code == code {
168 return false
169 }
170 }
171 return true
172 }
173 return false
174}
175
176var (
177 errWriteTimeout = &netError{msg: "websocket: write timeout", timeout: true, temporary: true}

Callers 4

readPumpMethod · 0.92
TestJoinMessagesFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestJoinMessagesFunction · 0.68