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: StringStable 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: StringHuman-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: CommitStateKnown 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
impl Error
Sourcepub fn with_commit_state(self, state: CommitState) -> Error
pub fn with_commit_state(self, state: CommitState) -> Error
Set the known publication state.
Sourcepub fn new(code: impl Into<String>) -> Error
pub fn new(code: impl Into<String>) -> Error
Build an error with unknown publication state and no retry hint.
Sourcepub fn with_message(self, message: impl Into<String>) -> Error
pub fn with_message(self, message: impl Into<String>) -> Error
Set the message.
Sourcepub fn with_operation(self, operation: impl Into<String>) -> Error
pub fn with_operation(self, operation: impl Into<String>) -> Error
Set the operation pointer/id.
Sourcepub fn with_source(self, source: Source) -> Error
pub fn with_source(self, source: Source) -> Error
Bind the source digest.
Sourcepub fn with_source_digest(self, digest: impl Into<String>) -> Error
pub fn with_source_digest(self, digest: impl Into<String>) -> Error
Override the source digest directly.
Sourcepub fn with_target(self, target: impl Into<String>) -> Error
pub fn with_target(self, target: impl Into<String>) -> Error
Set the resolved target pointer.
Sourcepub fn with_matches(self, matches: usize) -> Error
pub fn with_matches(self, matches: usize) -> Error
Set the matches count.
Sourcepub fn with_context(self, context: Context) -> Error
pub fn with_context(self, context: Context) -> Error
Set the bounded context.
Sourcepub fn set_context(&mut self, context: Context)
pub fn set_context(&mut self, context: Context)
Set the bounded context (in-place variant for chaining after mutating other fields).
Sourcepub fn push_next_action(&mut self, action: NextAction)
pub fn push_next_action(&mut self, action: NextAction)
Push a structured argv next action.
Sourcepub fn with_retryable(self, retryable: bool) -> Error
pub fn with_retryable(self, retryable: bool) -> Error
Set the retryable hint. Unknown publication coerces true to false.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Error
Source§impl Serialize for Error
impl Serialize for Error
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.