判断是否为网络超时,便于快速失败重试。
(self, error: Exception)
| 861 | raise Exception(f"Invalid JSON response: {body_text[:200]}") from exc |
| 862 | |
| 863 | def _is_timeout_error(self, error: Exception) -> bool: |
| 864 | """判断是否为网络超时,便于快速失败重试。""" |
| 865 | error_lower = str(error).lower() |
| 866 | return any(keyword in error_lower for keyword in [ |
| 867 | "timed out", |
| 868 | "timeout", |
| 869 | "curl: (28)", |
| 870 | "connection timed out", |
| 871 | "operation timed out", |
| 872 | ]) |
| 873 | |
| 874 | def _is_proxy_connection_error(self, error: Exception) -> bool: |
| 875 | """识别本地/上游代理不可用导致的连接失败。""" |
no outgoing calls
no test coverage detected