Skip to content

Commit 753637c

Browse files
committed
Check HTTP status codes in isTerminalError
Enhance isTerminalError() to check HTTP status codes before falling back to error message string matching. This provides more reliable error classification. Priority order: 1. HTTP status code (if available) - 4xx except 429 are terminal 2. Error message patterns (fallback) This ensures: - 400, 401, 403, 404 -> terminal (don't retry) - 429, 503, 5xx -> retryable (will retry) - Non-HTTP errors -> check message strings Addresses review feedback on PR #320
1 parent fa63f3b commit 753637c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

telemetry/errors.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ func isTerminalError(err error) bool {
1313
return false
1414
}
1515

16-
// Check error message patterns for terminal errors
16+
// Priority 1: Check HTTP status code if available (most reliable)
17+
if httpErr, ok := extractHTTPError(err); ok {
18+
return isTerminalHTTPStatus(httpErr.statusCode)
19+
}
20+
21+
// Priority 2: Fall back to error message patterns
1722
errMsg := strings.ToLower(err.Error())
1823
terminalPatterns := []string{
1924
"authentication failed",

0 commit comments

Comments
 (0)