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: RunErrorWhy 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>
impl<S: Debug> Debug for OutputFailure<S>
Source§impl<S> Display for OutputFailure<S>
impl<S> Display for OutputFailure<S>
Source§impl<S: Debug> Error for OutputFailure<S>
impl<S: Debug> Error for OutputFailure<S>
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()
Source§impl<S> From<OutputFailure<S>> for RunError
impl<S> From<OutputFailure<S>> for RunError
Source§fn from(failure: OutputFailure<S>) -> Self
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.