(cause: unknown)
| 137 | |
| 138 | /** Connection-fault code in the cause chain, if this is a connection fault at all. */ |
| 139 | const 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 |
no test coverage detected