feat(tui): classify error reasons on DOWN monitors #54

Merged
lerko merged 3 commits from feat/error-classification into main 2026-06-03 21:29:05 +00:00
2 changed files with 2 additions and 1 deletions
Showing only changes of commit c0ad51af9c - Show all commits
+1 -1
View File
@@ -51,7 +51,7 @@ func classifyError(errorReason string, siteType string, statusCode int) ErrorCat
if strings.Contains(lower, "connection refused") || strings.Contains(lower, "connection reset") || 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, "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 return ErrCatTCP
} }
+1
View File
@@ -43,6 +43,7 @@ func TestClassifyError(t *testing.T) {
{"connection reset by peer", "http", 0, ErrCatTCP}, {"connection reset by peer", "http", 0, ErrCatTCP},
{"dial tcp: no route to host", "http", 0, ErrCatTCP}, {"dial tcp: no route to host", "http", 0, ErrCatTCP},
{"network unreachable", "http", 0, ErrCatTCP}, {"network unreachable", "http", 0, ErrCatTCP},
{"failed to connect to 10.0.0.1:443", "http", 0, ErrCatTCP},
// HTTP // HTTP
{"HTTP 500 (expected 200-299)", "http", 500, ErrCatHTTP}, {"HTTP 500 (expected 200-299)", "http", 500, ErrCatHTTP},