(failure: unknown)
| 107 | * driver code (a SQLSTATE) is a deterministic query failure; nothing at all is |
| 108 | * `unknown`. */ |
| 109 | export const userStoreReasonFromCause = (failure: unknown): UserStoreFailureReason => { |
| 110 | const codes = driverCodesOf(failure); |
| 111 | for (const code of codes) { |
| 112 | const reason = REASON_BY_DRIVER_CODE[code]; |
| 113 | if (reason !== undefined) return reason; |
| 114 | } |
| 115 | return codes.length > 0 ? "query" : "unknown"; |
| 116 | }; |
| 117 | |
| 118 | /** Build the public `UserStoreError` for a store-adapter failure, naming the |
| 119 | * operation the call site already knows and classifying the driver cause. */ |
no test coverage detected