pub struct AxError { /* private fields */ }Expand description
The unified error shape: seven wire fields and two that are left out
when absent, serialized in declaration order (determinism rule 6).
The model is the recovery subject: nearby and recovery must hold
directly executable information, not apologies.
Everything but code sits behind one Box so the type stays cheap in
every seam’s return slot (result_large_err); serde flatten keeps the
wire shape flat and the field order unchanged.
Implementations§
Source§impl AxError
impl AxError
Sourcepub fn failure(
code: AxCode,
action: impl Into<String>,
subject: impl Into<String>,
) -> ErrorDraft
pub fn failure( code: AxCode, action: impl Into<String>, subject: impl Into<String>, ) -> ErrorDraft
Non-gate failure. retry starts No (fail-closed) and
nearby starts empty; both grow on the draft.
Sourcepub fn refusal(
code: AxCode,
action: impl Into<String>,
subject: impl Into<String>,
gate: GateRefusal,
) -> ErrorDraft
pub fn refusal( code: AxCode, action: impl Into<String>, subject: impl Into<String>, gate: GateRefusal, ) -> ErrorDraft
Gate refusal: the only constructor that sets the three mandatory parts. Gate-carrier codes must come through here (kernel::gate is their sole producer).
Sourcepub fn provider(
kind: ProviderFailureKind,
action: impl Into<String>,
subject: impl Into<String>,
) -> ErrorDraft
pub fn provider( kind: ProviderFailureKind, action: impl Into<String>, subject: impl Into<String>, ) -> ErrorDraft
An E_PROVIDER error that names the kind of failure a model
call met. retry starts No like any failure: whether the
request may go out again is decided by the gateway’s
ProviderFailure::retry, which sees more than the kind does.
pub fn code(&self) -> &AxCode
pub fn action(&self) -> &str
pub fn subject(&self) -> &str
pub fn nearby(&self) -> &[String]
pub fn recovery(&self) -> &str
pub fn retry(&self) -> Retry
Sourcepub fn retry_after_ms(&self) -> Option<u64>
pub fn retry_after_ms(&self) -> Option<u64>
The least the raiser says to wait before asking again, when it
said one; present only on a Retry::Yes error.
Sourcepub fn account(&self) -> AccountDisposition
pub fn account(&self) -> AccountDisposition
Whether the account this request went out on can still take it;
Advance comes only with Retry::No (D53).
pub fn gate(&self) -> Option<&GateRefusal>
pub fn provider_failure(&self) -> Option<ProviderFailureKind>
Sourcepub fn rewrite_recovery(self, recovery: impl Into<String>) -> Self
pub fn rewrite_recovery(self, recovery: impl Into<String>) -> Self
Replaces the recovery sentence of an error raised further down,
for a caller who knows a better next step than its raiser did.
Named apart from ErrorDraft::with_recovery because it destroys
a sentence rather than supplying the first one.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AxError
impl<'de> Deserialize<'de> for AxError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AxError
Source§impl Error for AxError
impl Error for AxError
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()