(failure: unknown)
| 88 | }; |
| 89 | |
| 90 | const driverCodesOf = (failure: unknown): readonly string[] => { |
| 91 | const codes: string[] = []; |
| 92 | let current: unknown = isServiceAdapterError(failure) ? failure.cause : failure; |
| 93 | for ( |
| 94 | let depth = 0; |
| 95 | depth < MAX_CAUSE_DEPTH && current !== undefined && current !== null; |
| 96 | depth++ |
| 97 | ) { |
| 98 | const code = stringCodeOf(current); |
| 99 | if (code !== undefined) codes.push(code); |
| 100 | current = |
| 101 | typeof current === "object" ? (current as { readonly cause?: unknown }).cause : undefined; |
| 102 | } |
| 103 | return codes; |
| 104 | }; |
| 105 | |
| 106 | /** Classify a raw store failure. A recognised connection code wins; any other |
| 107 | * driver code (a SQLSTATE) is a deterministic query failure; nothing at all is |
no test coverage detected