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

Function fumaFailureFromCause

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

Source from the content-addressed store, hash-verified

199 Predicate.isTagged(error, "UniqueViolationError");
200
201export const fumaFailureFromCause = (label: string, cause: unknown): StorageFailure => {
202 if (isStorageFailure(cause)) return cause;
203 if (isUniqueViolation(cause)) return new UniqueViolationError({ model: label });
204 const connectionCode = connectionFaultCode(cause);
205 if (connectionCode !== undefined) {
206 return new StorageConnectionError({
207 message: stableMessage(label, connectionCode),
208 label,
209 code: connectionCode,
210 retryable: RETRYABLE_CONNECTION_CODES.has(connectionCode),
211 cause,
212 });
213 }
214 return new StorageError({
215 message: stableMessage(label, causeCode(cause)),
216 operation: label,
217 code: causeCode(cause),
218 cause,
219 });
220};
221
222export const fumaEffect = <A>(
223 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