Skip to main content

BatchError

Enum BatchError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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: LintResult

The 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

Source

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).

Source

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.

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BatchError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for BatchError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<AcquireError> for BatchError

Source§

fn from(_: AcquireError) -> Self

Converts to this type from the input type.
Source§

impl From<JoinError> for BatchError

Source§

fn from(e: JoinError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> HostError for T
where T: Any + Error + Send + Sync + 'static,