MCPcopy
hub / github.com/keploy/keploy / IsShutdownError

Function IsShutdownError

utils/utils.go:52–67  ·  view source on GitHub ↗

IsShutdownError checks if the error is related to shutdown (EOF, connection closed, etc.) This is useful for gracefully handling errors during application shutdown.

(err error)

Source from the content-addressed store, hash-verified

50// IsShutdownError checks if the error is related to shutdown (EOF, connection closed, etc.)
51// This is useful for gracefully handling errors during application shutdown.
52func IsShutdownError(err error) bool {
53 if err == nil {
54 return false
55 }
56 // Check for EOF errors
57 if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) {
58 return true
59 }
60 // Check error message for common shutdown-related patterns
61 errStr := err.Error()
62 return strings.Contains(errStr, "EOF") ||
63 strings.Contains(errStr, "connection refused") ||
64 strings.Contains(errStr, "connection reset") ||
65 strings.Contains(errStr, "broken pipe") ||
66 strings.Contains(errStr, "use of closed network connection")
67}
68
69func ReplaceHost(currentURL string, ipAddress string) (string, error) {
70 // Parse the current URL

Callers 5

GetTestAndMockChansMethod · 0.92
GetIncomingMethod · 0.92
GetOutgoingMethod · 0.92
GetMappingsMethod · 0.92
HandleOutgoingMethod · 0.92

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected