(failure: unknown)
| 67 | }; |
| 68 | |
| 69 | const driverCodesOf = (failure: unknown): readonly string[] => { |
| 70 | const codes: string[] = []; |
| 71 | let current: unknown = isServiceAdapterError(failure) ? failure.cause : failure; |
| 72 | for ( |
| 73 | let depth = 0; |
| 74 | depth < MAX_CAUSE_DEPTH && current !== undefined && current !== null; |
| 75 | depth++ |
| 76 | ) { |
| 77 | const code = stringCodeOf(current); |
| 78 | if (code !== undefined) codes.push(code); |
| 79 | current = |
| 80 | typeof current === "object" ? (current as { readonly cause?: unknown }).cause : undefined; |
| 81 | } |
| 82 | return codes; |
| 83 | }; |
| 84 | |
| 85 | /** Classify a raw store failure. A recognised connection code wins; any other |
| 86 | * driver code (a SQLSTATE) is a deterministic query failure; nothing at all is |
no test coverage detected