(failure: unknown)
| 86 | * driver code (a SQLSTATE) is a deterministic query failure; nothing at all is |
| 87 | * `unknown`. */ |
| 88 | export const userStoreReasonFromCause = (failure: unknown): UserStoreFailureReason => { |
| 89 | const codes = driverCodesOf(failure); |
| 90 | for (const code of codes) { |
| 91 | const reason = REASON_BY_DRIVER_CODE[code]; |
| 92 | if (reason !== undefined) return reason; |
| 93 | } |
| 94 | return codes.length > 0 ? "query" : "unknown"; |
| 95 | }; |
| 96 | |
| 97 | /** Build the public `UserStoreError` for a store-adapter failure, naming the |
| 98 | * operation the call site already knows and classifying the driver cause. */ |
no test coverage detected