IsNetworkError checks if the error is a network connectivity issue
(err error)
| 695 | |
| 696 | // IsNetworkError checks if the error is a network connectivity issue |
| 697 | func IsNetworkError(err error) bool { |
| 698 | if err == nil { |
| 699 | return false |
| 700 | } |
| 701 | if netErr, ok := err.(net.Error); ok { |
| 702 | if netErr.Timeout() { |
| 703 | return true |
| 704 | } |
| 705 | } |
| 706 | msg := strings.ToLower(err.Error()) |
| 707 | return messageContainsAny(msg, |
| 708 | "connection refused", |
| 709 | "no route to host", |
| 710 | "operation timed out", |
| 711 | "i/o timeout", |
| 712 | "network is unreachable", |
| 713 | ) |
| 714 | } |
| 715 | |
| 716 | // ClassifySSHError determines the type of SSH error for reporting |
| 717 | func ClassifySSHError(err error) SSHRetryStatus { |
no test coverage detected