MCPcopy Create free account
hub / github.com/effect-app/libs / thrownIsTransient

Function thrownIsTransient

packages/infra/src/Store/Cosmos.ts:40–46  ·  view source on GitHub ↗
(e: unknown)

Source from the content-addressed store, hash-verified

38// A thrown SDK error is transient if its status/code is retryable or its message
39// looks like a timeout / throttle / dropped connection.
40const thrownIsTransient = (e: unknown): boolean => {
41 const code = (e as any)?.code ?? (e as any)?.statusCode
42 if (typeof code === "number" && RETRYABLE_COSMOS_STATUS.has(code)) return true
43 const msg = e instanceof Error ? e.message : String(e)
44 return /request timed out|timed out|\btimeout\b|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EAI_AGAIN|socket hang up|ServiceUnavailable|RequestTimeout|TooManyRequests|throttl/i
45 .test(msg)
46}
47
48// Wrap a Cosmos SDK promise so a rejection becomes a typed, serializable
49// `DatabaseError` (transient-classified) instead of a bare-`Error` defect — the

Callers 1

tryCosmosFunction · 0.85

Calls 2

StringInterface · 0.50
hasMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…