File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
app/src/main/java/com/xiaomo/androidforclaw/agent/context Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,19 @@ object ContextErrors {
126126 fun isTransientHttpError (errorMessage : String? ): Boolean {
127127 if (errorMessage.isNullOrBlank()) return false
128128 val trimmed = errorMessage.trim()
129- val status = extractLeadingHttpStatus(trimmed) ? : return false
130- return status in TRANSIENT_HTTP_ERROR_CODES
129+ // HTTP status code check
130+ val status = extractLeadingHttpStatus(trimmed)
131+ if (status != null && status in TRANSIENT_HTTP_ERROR_CODES ) return true
132+ // Connection-level errors: cancelled streams, reset connections, broken pipes
133+ val lower = trimmed.lowercase()
134+ return lower.contains(" cancelled" ) ||
135+ lower.contains(" connection reset" ) ||
136+ lower.contains(" broken pipe" ) ||
137+ lower.contains(" connection was closed" ) ||
138+ lower.contains(" unexpected end of stream" ) ||
139+ lower.contains(" stream was reset" ) ||
140+ lower.contains(" socket closed" ) ||
141+ lower.contains(" canceled" ) // OkHttp American spelling
131142 }
132143
133144 /* *
You can’t perform that action at this time.
0 commit comments