MCPcopy Index your code
hub / github.com/coder/coder / IsConnError

Function IsConnError

aibridge/intercept/eventstream/eventstream.go:236–252  ·  view source on GitHub ↗

IsConnError checks if an error is related to client disconnection or context cancellation.

(err error)

Source from the content-addressed store, hash-verified

234
235// IsConnError checks if an error is related to client disconnection or context cancellation.
236func IsConnError(err error) bool {
237 if err == nil {
238 return false
239 }
240
241 if errors.Is(err, io.EOF) {
242 return true
243 }
244
245 if errors.Is(err, syscall.ECONNRESET) || errors.Is(err, syscall.EPIPE) || errors.Is(err, net.ErrClosed) {
246 return true
247 }
248
249 errStr := err.Error()
250 return strings.Contains(errStr, "broken pipe") ||
251 strings.Contains(errStr, "connection reset by peer")
252}
253
254func IsUnrecoverableError(err error) bool {
255 if errors.Is(err, context.Canceled) {

Callers 5

ProcessRequestMethod · 0.92
ProcessRequestMethod · 0.92
writeSSEMethod · 0.92
StartMethod · 0.85
IsUnrecoverableErrorFunction · 0.85

Calls 3

IsMethod · 0.45
ErrorMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected