(label: string, cause: unknown)
| 196 | Predicate.isTagged(error, "UniqueViolationError"); |
| 197 | |
| 198 | export const fumaFailureFromCause = (label: string, cause: unknown): StorageFailure => { |
| 199 | if (isStorageFailure(cause)) return cause; |
| 200 | if (isUniqueViolation(cause)) return new UniqueViolationError({ model: label }); |
| 201 | const connectionCode = connectionFaultCode(cause); |
| 202 | if (connectionCode !== undefined) { |
| 203 | return new StorageConnectionError({ |
| 204 | message: stableMessage(label, connectionCode), |
| 205 | label, |
| 206 | code: connectionCode, |
| 207 | retryable: RETRYABLE_CONNECTION_CODES.has(connectionCode), |
| 208 | cause, |
| 209 | }); |
| 210 | } |
| 211 | return new StorageError({ |
| 212 | message: stableMessage(label, causeCode(cause)), |
| 213 | cause, |
| 214 | }); |
| 215 | }; |
| 216 | |
| 217 | export const fumaEffect = <A>( |
| 218 | label: string, |
no test coverage detected