mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
Reuse canonical typed failure attribution instead of copying cleanup markers. Preserve captured facts, typed primary outcomes and opaque cancellation reasons; bind caller projections to the exact producer cleanup owner. Refs: #4693
25 lines
707 B
TypeScript
25 lines
707 B
TypeScript
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
import { analysisClientFailureForOperation } from "../providers/AnalysisClientFailure.js";
|
|
import { KUNA_PROVIDER_ID } from "./KunaRelease.js";
|
|
|
|
/** Keep one producer failure immutable while each waiter receives its context. */
|
|
export const kunaQueryFailureForCaller = (
|
|
source: AnalysisError,
|
|
operation: string,
|
|
): AnalysisError => {
|
|
if (
|
|
!("operation" in source) ||
|
|
typeof source.operation !== "string" ||
|
|
source.operation === operation
|
|
)
|
|
return source;
|
|
return analysisClientFailureForOperation(
|
|
source,
|
|
KUNA_PROVIDER_ID,
|
|
operation,
|
|
{
|
|
producer_operation: source.operation,
|
|
},
|
|
);
|
|
};
|