#[non_exhaustive]pub enum BatchError {
TaskFailed(JoinError),
ShutdownInProgress,
DocumentDeadlineExceeded {
partial_lint: LintResult,
},
}Expand description
Error returned when a single document in a batch fails to process.
Batch APIs surface this per-document so a panic, cancellation, or graceful shutdown of the underlying concurrency controller does not abort the entire batch run.
#[non_exhaustive] because future infrastructure-level errors
(deadline expired, cache write-through failed, queue overflow,
etc.) will land as new variants alongside the existing two. A
downstream match should always carry a wildcard arm; without
non_exhaustive every new variant would be a semver-breaking
change for consumers, which would either pin them to a stale
version or pressure us to never grow the surface.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TaskFailed(JoinError)
The blocking lint/fix task panicked or was cancelled.
ShutdownInProgress
The ConcurrencyController semaphore was closed while this
document was waiting for a permit. Indicates the runtime is in
shutdown — the caller has no work to do beyond observing the
error and ending its loop.
Whitepaper §9.4 / gap register #8 carved this out as a separate
variant so deployment supervisors can distinguish it from a
real worker-task panic. is_panic() returns false for this
variant; is_shutdown() returns true.
DocumentDeadlineExceeded
fix_many aborted this document’s fix pass because the
per-document deadline (set on BatchOptions::per_doc_deadline)
expired. Spec 005 §R4 / Constitution V Principle V — no partial
FixResult is ever produced; the caller receives the partial
LintResult so it can render whatever diagnostics the engine
surfaced before the abort.
is_deadline_exceeded() returns true for this variant only.
is_panic() and is_shutdown() return false — a deadline
trip is a routine operational signal, not a worker bug or
runtime shutdown.
Note: only the fix path produces this variant. lint_many
surfaces a deadline-truncated lint as Ok(LintResult { truncated: true, .. }) so the partial diagnostics flow through the same
success channel — there is no asymmetric response shape on the
lint side because no audit-stream invariant is at risk.
Fields
partial_lint: LintResultThe lint pass produced before the deadline tripped. May
itself be truncated (partial_lint.truncated) if the
deadline expired during the lint phase rather than the
fix-application phase.
Implementations§
Source§impl BatchError
impl BatchError
Sourcepub fn is_panic(&self) -> bool
pub fn is_panic(&self) -> bool
Returns true if the error was caused by a panic in the worker task.
CI pipelines and supervisors should treat this as an application bug that warrants investigation (not a transient infrastructure issue).
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns true if the error was caused by task cancellation (e.g.,
runtime shutdown, explicit abort).
Cancellation is an expected operational event — callers that see this during a graceful shutdown should typically log-and-continue, not alert.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true if the error was caused by the ConcurrencyController
semaphore being closed while this document was awaiting a permit.
Distinct from is_cancelled() (which fires when a worker task is
aborted mid-execution) and from is_panic() (which fires on a real
bug). Shutdown is the routine end-of-life signal — supervisors
should drain any remaining items in the result stream and exit.
Sourcepub fn is_deadline_exceeded(&self) -> bool
pub fn is_deadline_exceeded(&self) -> bool
Returns true if this error was caused by the per-document
deadline expiring during a fix_many call.
Routine operational signal — the document took longer to
process than its budget allowed. Callers should render the
embedded partial_lint diagnostics and either skip the
document or retry with a larger budget. Distinct from
is_panic() (worker bug) and is_shutdown() (runtime
end-of-life).
Trait Implementations§
Source§impl Debug for BatchError
impl Debug for BatchError
Source§impl Display for BatchError
impl Display for BatchError
Source§impl Error for BatchError
impl Error for BatchError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()