MCPcopy Create free account
hub / github.com/Noumena-Network/code / isTransientNetworkError

Function isTransientNetworkError

src/utils/teleport/api.ts:27–44  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

25 * Checks if an axios error is a transient network error that should be retried
26 */
27export function isTransientNetworkError(error: unknown): boolean {
28 if (!axios.isAxiosError(error)) {
29 return false
30 }
31
32 // Retry on network errors (no response received)
33 if (!error.response) {
34 return true
35 }
36
37 // Retry on server errors (5xx)
38 if (error.response.status >= 500) {
39 return true
40 }
41
42 // Don't retry on client errors (4xx) - they're not transient
43 return false
44}
45
46/**
47 * Makes an axios GET request with automatic retry for transient network errors

Callers 2

axiosGetWithRetryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected