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

Function fumaFailureFromCause

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

Source from the content-addressed store, hash-verified

179 Predicate.isTagged(error, "UniqueViolationError");
180
181export 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
200export const fumaEffect = <A>(
201 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