(cause: unknown)
| 153 | |
| 154 | /** Connection-fault code in the cause chain, if this is a connection fault at all. */ |
| 155 | const connectionFaultCode = (cause: unknown): string | undefined => { |
| 156 | let found: string | undefined; |
| 157 | walkCauses(cause, (err) => { |
| 158 | const code = err["code"]; |
| 159 | if ( |
| 160 | typeof code === "string" && |
| 161 | (RETRYABLE_CONNECTION_CODES.has(code) || FATAL_CONNECTION_CODES.has(code)) |
| 162 | ) { |
| 163 | found = code; |
| 164 | return true; |
| 165 | } |
| 166 | // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: workerd's cross-request I/O rejection carries no code, only this fixed message |
| 167 | const message = err["message"]; |
| 168 | if (typeof message === "string" && CROSS_REQUEST_IO_PATTERN.test(message)) { |
| 169 | found = CROSS_REQUEST_IO_CODE; |
| 170 | return true; |
| 171 | } |
| 172 | return false; |
| 173 | }); |
| 174 | return found; |
| 175 | }; |
| 176 | |
| 177 | /** |
| 178 | * Build the failure message from stable inputs only — the call-site label and |
no test coverage detected