withFallback
withFallback<
In,Out>(primary,fallback):Stage<In,Out>
Defined in: packages/engine/src/lib/planner/with-fallback.ts:24
Runs primary, and runs fallback with the same input and context only
when primary returns a Deferred. Candidates and EngineErrors from
primary are returned unchanged, so a real failure is never masked by a
second attempt.
The two run one after the other: on deferral the latencies add up. Both stages share the request’s signal and must honour it.
Type Parameters
Section titled “Type Parameters”In
Out
Parameters
Section titled “Parameters”primary
Section titled “primary”Stage<In, Out>
fallback
Section titled “fallback”Stage<In, Out>
Returns
Section titled “Returns”Stage<In, Out>
Example
Section titled “Example”// `modelPlanner` is any `Planner`, for example one that calls a model.const planner = withFallback( pipeline(selectVessels, arrangeLayout), modelPlanner,);