MCPcopy Index your code
hub / github.com/coder/websocket / CloseStatus

Function CloseStatus

close.go:78–84  ·  view source on GitHub ↗

CloseStatus is a convenience wrapper around Go 1.13's errors.As to grab the status code from a CloseError. -1 will be returned if the passed error is nil or not a CloseError.

(err error)

Source from the content-addressed store, hash-verified

76//
77// -1 will be returned if the passed error is nil or not a CloseError.
78func CloseStatus(err error) StatusCode {
79 var ce CloseError
80 if errors.As(err, &ce) {
81 return ce.Code
82 }
83 return -1
84}
85
86// Close performs the WebSocket close handshake with the given status code and reason.
87//

Callers 9

assertCloseStatusFunction · 0.92
ExampleCloseStatusFunction · 0.92
assertCloseStatusFunction · 0.92
ServeHTTPMethod · 0.92
subscribeHandlerMethod · 0.92
closeHandshakeMethod · 0.70
TestCloseStatusFunction · 0.70
readLoopMethod · 0.70
readMethod · 0.70

Calls

no outgoing calls

Tested by 4

assertCloseStatusFunction · 0.74
ExampleCloseStatusFunction · 0.74
assertCloseStatusFunction · 0.74
TestCloseStatusFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…