Expand description
Error-handler wrapper — the OUTERMOST op-level wrapper (SRD-82 Part 3b).
Owns the op shell’s terminal-error handling, promoted out of the fiber
loop’s inline block: it routes the ONE terminal outcome of the stack
below it through the op’s resolved [ErrorPolicy], tallies the
result-level error counters, captures the error into the phase’s
structured buffer, and applies the stop/fail effects. Every op
dispenser carries its own policy — the op-level errors: override or
the enclosing shell’s policy shared by reference — so a lenient op
never softens its siblings.
The happy path is one branch. Ok results pass through untouched;
the pattern match, verb chain (count / warn / ignore / …), and
effects run only in the Err arm. The router’s verbs stay uniform
inside the compiled policy (the nmbrs-errorhandler ErrorHandler
chain) rather than as stacked dispenser layers — see SRD-82 Part 3b
for why per-verb wrappers were rejected (runtime rule-matched
activation, per-rule verb order, and happy-path layer cost).
This wrapper also owns the op’s PANIC BACKSTOP: a panic anywhere in
the stack below (traverse / result / metrics / adapter) is caught
here, synthesised into a panic op error, and routed through the
policy like any other terminal failure — so a panicking layer can
never kill the fiber, and the policy decides its disposition. (The
innermost TriesDispenser, when present, catches per-ATTEMPT panics
first; this is the whole-stack backstop.)
Structs§
- Error
Handler Dispenser - Wraps the whole op stack with terminal-error routing driven by the
op’s resolved [
ErrorPolicy]. Constructed OUTERMOST — hand-placed after the plan cascade, mirroring how the retry wrapper is hand-placed innermost — so it observes exactly one terminal outcome per cycle.