(cause: unknown)
| 123 | |
| 124 | /** First driver error code in the cause chain, if any. Never the error text. */ |
| 125 | const causeCode = (cause: unknown): string | undefined => { |
| 126 | let found: string | undefined; |
| 127 | walkCauses(cause, (err) => { |
| 128 | const code = err["code"]; |
| 129 | if (typeof code === "string" && code.length > 0) { |
| 130 | found = code; |
| 131 | return true; |
| 132 | } |
| 133 | return false; |
| 134 | }); |
| 135 | return found; |
| 136 | }; |
| 137 | |
| 138 | /** Connection-fault code in the cause chain, if this is a connection fault at all. */ |
| 139 | const connectionFaultCode = (cause: unknown): string | undefined => { |
no test coverage detected