MCPcopy Create free account
hub / github.com/coder/aibridge / IsConnError

Function IsConnError

intercept/eventstream/eventstream.go:209–225  ·  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

207
208// IsConnError checks if an error is related to client disconnection or context cancellation.
209func IsConnError(err error) bool {
210 if err == nil {
211 return false
212 }
213
214 if errors.Is(err, io.EOF) {
215 return true
216 }
217
218 if errors.Is(err, syscall.ECONNRESET) || errors.Is(err, syscall.EPIPE) || errors.Is(err, net.ErrClosed) {
219 return true
220 }
221
222 errStr := err.Error()
223 return strings.Contains(errStr, "broken pipe") ||
224 strings.Contains(errStr, "connection reset by peer")
225}
226
227func IsUnrecoverableError(err error) bool {
228 if errors.Is(err, context.Canceled) {

Callers 4

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

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected