fix(tui): classify safedial "failed to connect" as TCP
Error from safedial.go fell through to ErrCatUnknown, showing plain DOWN instead of DOWN:TCP.
This commit was merged in pull request #54.
This commit is contained in:
@@ -51,7 +51,7 @@ func classifyError(errorReason string, siteType string, statusCode int) ErrorCat
|
||||
|
||||
if strings.Contains(lower, "connection refused") || strings.Contains(lower, "connection reset") ||
|
||||
strings.Contains(lower, "no route to host") || strings.Contains(lower, "network unreachable") ||
|
||||
strings.Contains(lower, "network is unreachable") {
|
||||
strings.Contains(lower, "network is unreachable") || strings.Contains(lower, "failed to connect") {
|
||||
return ErrCatTCP
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ func TestClassifyError(t *testing.T) {
|
||||
{"connection reset by peer", "http", 0, ErrCatTCP},
|
||||
{"dial tcp: no route to host", "http", 0, ErrCatTCP},
|
||||
{"network unreachable", "http", 0, ErrCatTCP},
|
||||
{"failed to connect to 10.0.0.1:443", "http", 0, ErrCatTCP},
|
||||
|
||||
// HTTP
|
||||
{"HTTP 500 (expected 200-299)", "http", 500, ErrCatHTTP},
|
||||
|
||||
Reference in New Issue
Block a user