MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connectionFaultCode

Function connectionFaultCode

packages/core/sdk/src/fuma-runtime.ts:139–159  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

137
138/** Connection-fault code in the cause chain, if this is a connection fault at all. */
139const connectionFaultCode = (cause: unknown): string | undefined => {
140 let found: string | undefined;
141 walkCauses(cause, (err) => {
142 const code = err["code"];
143 if (
144 typeof code === "string" &&
145 (RETRYABLE_CONNECTION_CODES.has(code) || FATAL_CONNECTION_CODES.has(code))
146 ) {
147 found = code;
148 return true;
149 }
150 // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: workerd's cross-request I/O rejection carries no code, only this fixed message
151 const message = err["message"];
152 if (typeof message === "string" && CROSS_REQUEST_IO_PATTERN.test(message)) {
153 found = CROSS_REQUEST_IO_CODE;
154 return true;
155 }
156 return false;
157 });
158 return found;
159};
160
161/**
162 * Build the failure message from stable inputs only — the call-site label and

Callers 1

fumaFailureFromCauseFunction · 0.85

Calls 1

walkCausesFunction · 0.85

Tested by

no test coverage detected