MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / fumaFailureFromCause

Function fumaFailureFromCause

packages/core/sdk/src/fuma-runtime.ts:198–215  ·  view source on GitHub ↗
(label: string, cause: unknown)

Source from the content-addressed store, hash-verified

196 Predicate.isTagged(error, "UniqueViolationError");
197
198export 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
217export const fumaEffect = <A>(
218 label: string,

Callers 3

fumaEffectFunction · 0.85
transactionFunction · 0.85

Calls 5

isStorageFailureFunction · 0.85
isUniqueViolationFunction · 0.85
connectionFaultCodeFunction · 0.85
stableMessageFunction · 0.85
causeCodeFunction · 0.85

Tested by

no test coverage detected