pub enum ActionCallError {
Unavailable {
reason: String,
},
UnknownAction,
NotPermitted,
ConfirmationRequired(Box<AskedFacts>),
InvalidRequest {
reason: String,
},
StaleRevision,
UnknownInvocation,
InvocationConflict,
NotCancellable {
reason: String,
},
Refused {
reason: String,
},
NotReady,
Unanswered,
}Expand description
Why a provider would not do what was asked. Every variant but Self::Unanswered means
nothing ran.
On the wire it keeps the shape peers decoded before
Self::StaleRevision existed: that variant travels as the
Self::InvalidRequest those peers sent and understand, and such a
refusal from them reads back as it. A variant an older peer cannot
decode would fail its whole frame.
Variants§
The provider serves no actions right now (no live apps, service off).
UnknownAction
The target is not offered to this caller — unknown and forbidden are deliberately the same answer.
NotPermitted
The caller’s authority does not cover the action.
ConfirmationRequired(Box<AskedFacts>)
The action waits for a person’s yes this request did not carry: what
they are shown (asked::AskedFacts). The dispatch keeps the call as
an asked invocation record, and their approve admits it again.
InvalidRequest
The request is malformed for this action (arguments, input).
StaleRevision
The target changed since the revision the request named, or the one its provider resolved it against: list it again and invoke what is offered now.
UnknownInvocation
The invocation id is unknown to this caller.
InvocationConflict
The invocation id was already used for a different request.
NotCancellable
The invocation cannot be cancelled (finished, or never cancellable).
Refused
The provider refused for a reason of its own.
NotReady
The workspace is not serving this caller here yet: the same call
works once it is (its serving state).
Unanswered
The device or provider that runs the call did not answer in time. Unlike every other variant this one does not say that nothing ran: the same call under the same invocation id is answered by what it did, and runs it once if it never arrived.
Implementations§
Source§impl ActionCallError
impl ActionCallError
Sourcepub fn from_api(error: &ApiError) -> Self
pub fn from_api(error: &ApiError) -> Self
A refusal of the action API (crate::api) as the action wire says it: the API’s own
code, so a caller tells “no such action” apart from “not now” and “not shaped like that”
without reading prose. An API that refused for a reason of its own says it in words, its
code leading them.
Sourcepub fn confirmation_required() -> Self
pub fn confirmation_required() -> Self
The refusal for want of the person’s answer, for an action whose name says all the person is shown.
Sourcepub fn asks(facts: AskedFacts) -> Self
pub fn asks(facts: AskedFacts) -> Self
The refusal for want of the person’s answer, showing them facts.
Sourcepub fn refused(reason: impl Into<String>) -> Self
pub fn refused(reason: impl Into<String>) -> Self
The provider refused for a reason of its own.
Sourcepub fn own_words(&self) -> String
pub fn own_words(&self) -> String
What the provider said in its own words, for the person reading it: the reason a refusal of its own carries, without the code a caller matches on, else the sentence of its variant.
Sourcepub fn invalid_request(reason: impl Into<String>) -> Self
pub fn invalid_request(reason: impl Into<String>) -> Self
The request is malformed for this action.
The provider serves no actions right now.
Sourcepub fn said(&self) -> String
pub fn said(&self) -> String
This refusal as a caller is told it: the code the API documents
(docs/tilo-sh/errors.md), then what happened, so a caller reading the
typed answer gets the code and one reading the text still reads a
sentence that says what to do.
Sourcepub const fn ask_again(&self) -> bool
pub const fn ask_again(&self) -> bool
Whether the same call, under the same invocation id, is worth making
again: once the workspace serves the caller (Self::NotReady), or at
once (Self::Unanswered).
Sourcepub fn ask_again_code(code: &str) -> bool
pub fn ask_again_code(code: &str) -> bool
Whether code is the code of a refusal the same call is asked again
for (Self::ask_again), as a failed invocation carries it.
Sourcepub fn needs_revision(&self) -> bool
pub fn needs_revision(&self) -> bool
Whether the provider refused a directory action that asks for
confirmation because the request named no revision
(CONFIRMED_ACTION_NEEDS_REVISION).
Trait Implementations§
Source§impl Clone for ActionCallError
impl Clone for ActionCallError
Source§impl Debug for ActionCallError
impl Debug for ActionCallError
Source§impl<'de> Deserialize<'de> for ActionCallError
impl<'de> Deserialize<'de> for ActionCallError
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>,
Source§impl Display for ActionCallError
impl Display for ActionCallError
impl Eq for ActionCallError
Source§impl Error for ActionCallError
impl Error for ActionCallError
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()
Source§impl From<ActionCallError> for Unresolved
impl From<ActionCallError> for Unresolved
Source§fn from(refused: ActionCallError) -> Self
fn from(refused: ActionCallError) -> Self
Source§impl PartialEq for ActionCallError
impl PartialEq for ActionCallError
Source§impl Serialize for ActionCallError
impl Serialize for ActionCallError
impl StructuralPartialEq for ActionCallError
Auto Trait Implementations§
impl Forget for ActionCallError
impl Freeze for ActionCallError
impl Move for ActionCallError
impl RefUnwindSafe for ActionCallError
impl Send for ActionCallError
impl Sync for ActionCallError
impl Unpin for ActionCallError
impl UnsafeUnpin for ActionCallError
impl UnwindSafe for ActionCallError
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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