MCPcopy Create free account
hub / github.com/tiann/hapi / isRetryableConnectionError

Function isRetryableConnectionError

cli/src/utils/errorUtils.ts:98–117  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

96 * - other 4xx errors
97 */
98export function isRetryableConnectionError(error: unknown): boolean {
99 const { axiosCode, httpStatus } = extractErrorInfo(error)
100
101 // Retryable network errors
102 if (axiosCode === 'ECONNREFUSED' ||
103 axiosCode === 'ETIMEDOUT' ||
104 axiosCode === 'ENOTFOUND' ||
105 axiosCode === 'ENETUNREACH' ||
106 axiosCode === 'ECONNRESET') {
107 return true
108 }
109
110 // 5xx server errors are retryable
111 if (httpStatus && httpStatus >= 500) {
112 return true
113 }
114
115 // Other errors (401, 403, 404, etc.) are not retryable
116 return false
117}

Callers

nothing calls this directly

Calls 1

extractErrorInfoFunction · 0.85

Tested by

no test coverage detected