Skip to main content

Error

Struct Error 

Source
pub struct Error {
    pub code: String,
    pub operation: Option<String>,
    pub source_digest: Option<String>,
    pub target: Option<String>,
    pub matches: Option<usize>,
    pub context: Option<Context>,
    pub near: Option<NearMatches>,
    pub message: String,
    pub next_actions: Vec<NextAction>,
    pub retryable: Option<bool>,
    pub commit_state: CommitState,
    pub expectations: Option<ExpectationReport>,
}
Expand description

An error block for a refused or failed result.

Fields§

§code: String

Stable error code (NO_CHANGES_REQUESTED, AMBIGUOUS_ANCHOR, …).

§operation: Option<String>

Operation pointer/id (e.g. op-2, /operations/1).

§source_digest: Option<String>

SHA-256 of the source the request bound to.

§target: Option<String>

Resolved target pointer (paragraph id or similar).

§matches: Option<usize>

Number of matches found (1 on success, >1 on ambiguity, 0 on miss).

§context: Option<Context>

Bounded actual context around the failure point.

§near: Option<NearMatches>

Whitespace-only diagnostic occurrences. They never authorize selection.

§message: String

Human-readable detail.

§next_actions: Vec<NextAction>

Structured argv next actions; never shell strings.

§retryable: Option<bool>

retryable hint: Some(true) when a retry with the same inputs is safe, Some(false) when it is not, None when the classification is unknown. Implementations are free to omit it.

§commit_state: CommitState

Known primary publication state; unknown never authorizes retry.

§expectations: Option<ExpectationReport>

The bounded expectation report behind this failure, when the error is an expectation verdict (EXPECTATION_FAILED, …). Kept beside the error so a refused envelope still discloses which checks ran, refused or stayed unassessed.

Implementations§

Source§

impl Error

Source

pub fn with_commit_state(self, state: CommitState) -> Error

Set the known publication state.

Source

pub fn new(code: impl Into<String>) -> Error

Build an error with unknown publication state and no retry hint.

Source

pub fn with_message(self, message: impl Into<String>) -> Error

Set the message.

Source

pub fn with_operation(self, operation: impl Into<String>) -> Error

Set the operation pointer/id.

Source

pub fn with_source(self, source: Source) -> Error

Bind the source digest.

Source

pub fn with_source_digest(self, digest: impl Into<String>) -> Error

Override the source digest directly.

Source

pub fn with_target(self, target: impl Into<String>) -> Error

Set the resolved target pointer.

Source

pub fn with_matches(self, matches: usize) -> Error

Set the matches count.

Source

pub fn with_context(self, context: Context) -> Error

Set the bounded context.

Source

pub fn set_context(&mut self, context: Context)

Set the bounded context (in-place variant for chaining after mutating other fields).

Source

pub fn push_next_action(&mut self, action: NextAction)

Push a structured argv next action.

Source

pub fn with_retryable(self, retryable: bool) -> Error

Set the retryable hint. Unknown publication coerces true to false.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

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

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

impl<'de> Deserialize<'de> for Error

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Error, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Error

Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Error) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Error

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.