(label: string, cause: unknown)
| 179 | Predicate.isTagged(error, "UniqueViolationError"); |
| 180 | |
| 181 | export const fumaFailureFromCause = (label: string, cause: unknown): StorageFailure => { |
| 182 | if (isStorageFailure(cause)) return cause; |
| 183 | if (isUniqueViolation(cause)) return new UniqueViolationError({ model: label }); |
| 184 | const connectionCode = connectionFaultCode(cause); |
| 185 | if (connectionCode !== undefined) { |
| 186 | return new StorageConnectionError({ |
| 187 | message: stableMessage(label, connectionCode), |
| 188 | label, |
| 189 | code: connectionCode, |
| 190 | retryable: RETRYABLE_CONNECTION_CODES.has(connectionCode), |
| 191 | cause, |
| 192 | }); |
| 193 | } |
| 194 | return new StorageError({ |
| 195 | message: stableMessage(label, causeCode(cause)), |
| 196 | cause, |
| 197 | }); |
| 198 | }; |
| 199 | |
| 200 | export const fumaEffect = <A>( |
| 201 | label: string, |
no test coverage detected