pub struct ErrorDraft { /* private fields */ }Expand description
An error that still owes the reader its recovery sentence.
Both constructors return this rather than an AxError, and
ErrorDraft::with_recovery is the only way across, so a failure that
never says what to do next cannot be spelled. Shaping happens here;
an AxError is finished the moment it exists.
Implementations§
Source§impl ErrorDraft
impl ErrorDraft
Sourcepub fn with_nearby(self, nearby: Vec<String>) -> Self
pub fn with_nearby(self, nearby: Vec<String>) -> Self
Names the spellings the caller could have used instead. Directly usable values only, not a description of them.
Sourcepub fn retriable(self) -> Self
pub fn retriable(self) -> Self
Declares the action safe to retry as-is. Explicit opt-in only.
Puts the account back to Keep: a request worth sending again
on this account is no reason to leave it.
Sourcepub fn effect_unknown(self) -> Self
pub fn effect_unknown(self) -> Self
Declares that the request went out and its answer was lost, so
whether its effect landed is not known. Drops any wait set
before it, because a wait belongs to Retry::Yes alone, and keeps
the account, because a lost answer is no evidence against it.
Sourcepub fn account_unusable(self) -> Self
pub fn account_unusable(self) -> Self
Declares that the account the request went out on cannot take it,
so the next account should (D53). Sets Retry::No and drops any
wait in the same step: the same request on the same account would
fail the same way, however long it waited.
Sourcepub fn retriable_after(self, wait_ms: u64) -> Self
pub fn retriable_after(self, wait_ms: u64) -> Self
Declares the action safe to retry, and no sooner than wait_ms
from now: the other side’s own word on when it recovers.
Sourcepub fn with_recovery(self, recovery: impl Into<String>) -> AxError
pub fn with_recovery(self, recovery: impl Into<String>) -> AxError
Writes the one sentence that tells the reader what to do next, and hands back the finished error. The reader is as often a model as a person, so the sentence names a key, a file and line, or a command.