MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / ClassifySSHError

Function ClassifySSHError

utils/ssh.go:717–735  ·  view source on GitHub ↗

ClassifySSHError determines the type of SSH error for reporting

(err error)

Source from the content-addressed store, hash-verified

715
716// ClassifySSHError determines the type of SSH error for reporting
717func ClassifySSHError(err error) SSHRetryStatus {
718 if err == nil {
719 return SSHStatusSuccess
720 }
721 if IsKeyParseError(err) {
722 return SSHStatusKeyParse
723 }
724 if IsAuthError(err) {
725 return SSHStatusAuth
726 }
727 if IsNetworkError(err) {
728 return SSHStatusDialing
729 }
730 msg := strings.ToLower(err.Error())
731 if messageContainsAny(msg, "handshake", "kex", "connection reset") {
732 return SSHStatusHandshake
733 }
734 return SSHStatusUnexpected
735}
736
737func messageContainsAny(msg string, substrings ...string) bool {
738 for _, sub := range substrings {

Callers 2

runConnectWithOptionsFunction · 0.92

Calls 5

IsKeyParseErrorFunction · 0.85
IsAuthErrorFunction · 0.85
IsNetworkErrorFunction · 0.85
messageContainsAnyFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected