pub struct EditError {
pub code: EditErrorCode,
pub message: String,
pub op: Option<usize>,
pub fix: Option<String>,
pub details: Option<Value>,
}Expand description
An edit rejected before anything was staged. Every message names the correct form where one exists, so the agent can resend a fixed call.
Fields§
§code: EditErrorCode§message: String§op: Option<usize>0-based index of the failing op, when the failure belongs to one.
fix: Option<String>The corrected form, e.g. a rewritten op or path.
details: Option<Value>Candidates, sibling lists, unknown ids and similar machine-readable context.
Implementations§
Source§impl EditError
impl EditError
Sourcepub fn new(code: EditErrorCode, message: impl Into<String>) -> Self
pub fn new(code: EditErrorCode, message: impl Into<String>) -> Self
An error without a fix or details; the builders below add them.
Sourcepub fn with_fix(self, fix: impl Into<String>) -> Self
pub fn with_fix(self, fix: impl Into<String>) -> Self
Adds the corrected form of the rejected call.
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Adds machine-readable context for the error.
Sourcepub fn at_op(self, index: usize) -> Self
pub fn at_op(self, index: usize) -> Self
Attributes the error to op index unless an inner step already did.
Sourcepub(crate) fn numeric_index(path: &str, items: &str) -> Self
pub(crate) fn numeric_index(path: &str, items: &str) -> Self
path addresses an item by position; items names what goes by id instead, e.g.
“blocks”.
Sourcepub(crate) fn expected_count_mismatch(
expected: usize,
found: usize,
matches: Vec<Value>,
) -> Self
pub(crate) fn expected_count_mismatch( expected: usize, found: usize, matches: Vec<Value>, ) -> Self
A bulk edit found found matches where the call expected expected; matches describes
each one for the agent.
Sourcepub(crate) fn position_required(fix: &str) -> Self
pub(crate) fn position_required(fix: &str) -> Self
An op that places items came without position; fix shows where items can go.
Trait Implementations§
Source§impl Error for EditError
impl Error for EditError
1.30.0 · 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()
impl StructuralPartialEq for EditError
Auto Trait Implementations§
impl Freeze for EditError
impl RefUnwindSafe for EditError
impl Send for EditError
impl Sync for EditError
impl Unpin for EditError
impl UnsafeUnpin for EditError
impl UnwindSafe for EditError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
§type Instrumented = TracedError<E>
type Instrumented = TracedError<E>
§fn in_current_span(self) -> <E as InstrumentError>::Instrumented
fn in_current_span(self) -> <E as InstrumentError>::Instrumented
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].