MCPcopy
hub / github.com/redis/go-redis / isTimeoutError

Function isTimeoutError

extra/redisotel-native/metrics.go:340–358  ·  view source on GitHub ↗

isTimeoutError checks if an error is a timeout error

(err error)

Source from the content-addressed store, hash-verified

338
339// isTimeoutError checks if an error is a timeout error
340func isTimeoutError(err error) bool {
341 if err == nil {
342 return false
343 }
344
345 // Check for timeoutError interface (works with wrapped errors)
346 var te timeoutError
347 if errors.As(err, &te) {
348 return te.Timeout()
349 }
350
351 // Check for net.Error specifically (common case for network timeouts)
352 var netErr net.Error
353 if errors.As(err, &netErr) {
354 return netErr.Timeout()
355 }
356
357 return false
358}
359
360// getErrorCategory returns the error category from an error.
361// It checks for TLS, auth, network, and server errors.

Callers 2

classifyErrorFunction · 0.70
getErrorCategoryFunction · 0.70

Calls 1

TimeoutMethod · 0.95

Tested by

no test coverage detected