Skip to main content

OutputFailure

Struct OutputFailure 

Source
pub struct OutputFailure<S> {
    pub error: RunError,
    pub report: Option<RunReport<S>>,
}
Expand description

A typed turn that produced no value — and everything it reported anyway.

The turn still happened. It spent tokens, it may have been ended by a bound rather than by the work, and it wrote a whole stream into the sink the caller lent it. A typed turn used to build that RunReport and then drop it on the floor, returning a bare RunError; a caller charging runs against a shared allowance, or deciding between re-asking with a clearer schema and backing off, was left to reconstruct from the event log what the run had already written down. Library first (ADR-0003) is judged by the in-process Rust consumer, and this is the shape that consumer needs: the error and the account.

The error is deliberately the same RunError the turn returned before, not a second vocabulary for the same failure — two names for one thing is how a host ends up matching on the wrong one. From hands it straight back, so a caller that wants nothing but the error writes .await.map_err(RunError::from)? and receives exactly what it always did: RunError::OutputMismatch for an answer T refused, RunError::Runtime for a turn that failed or never called the terminal tool.

Distinct from RunFailure, which is mentra’s own error as retained inside a report.

Fields§

§error: RunError

Why there is no value, in the same terms as before this type existed.

On a runtime failure this is where mentra’s original error lives, rather than in RunReport::failure: a RuntimeError is not Clone and cannot be in two places, and the error is where a caller reaching for ? looks. The validated path (output_parts_validated_with_options) returns Ok, so there the report is the only home and keeps it (ADR-0024 §4).

§report: Option<RunReport<S>>

Everything the turn reported before it came up empty, sink included.

None only when there was no turn to report on — an empty prompt, an option set that cannot be drawn, a sink that refused a write, a forwarding task that did not come back. Every failure of the turn itself carries its report.

Trait Implementations§

Source§

impl<S: Debug> Debug for OutputFailure<S>

Source§

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

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

impl<S> Display for OutputFailure<S>

Source§

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

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

impl<S: Debug> Error for OutputFailure<S>

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<S> From<OutputFailure<S>> for RunError

Source§

fn from(failure: OutputFailure<S>) -> Self

The error alone, worded exactly as the typed turn worded it before it carried a report. The report — and with it the sink — is dropped here, which is the whole cost of ? and the reason the richer type is what the turn returns.

Source§

impl<S> From<RunError> for OutputFailure<S>

Source§

fn from(error: RunError) -> Self

A failure with no turn behind it. See report.

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for OutputFailure<S>

§

impl<S> !UnwindSafe for OutputFailure<S>

§

impl<S> Freeze for OutputFailure<S>
where Option<RunReport<S>>: Freeze,

§

impl<S> Send for OutputFailure<S>
where Option<RunReport<S>>: Send,

§

impl<S> Sync for OutputFailure<S>
where Option<RunReport<S>>: Sync,

§

impl<S> Unpin for OutputFailure<S>
where Option<RunReport<S>>: Unpin,

§

impl<S> UnsafeUnpin for OutputFailure<S>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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