Skip to main content

RpcError

Enum RpcError 

Source
pub enum RpcError {
    NoRoute {
        target: u64,
        reason: String,
    },
    Timeout {
        elapsed_ms: u64,
    },
    ServerError {
        status: u16,
        message: String,
    },
    Transport(AdapterError),
    Codec {
        direction: CodecDirection,
        message: String,
    },
    CapabilityDenied {
        target: u64,
        capability: String,
    },
    Cancelled,
}
Expand description

What MeshNode::call returns on failure.

Variants§

§

NoRoute

No subscription / no route to the target. Either target_node_id is unknown to the local mesh, or the caller’s reply-channel subscription couldn’t be set up.

Fields

§target: u64

Target node id the call was directed at.

§reason: String

Diagnostic — typically the underlying transport error.

§

Timeout

Caller’s deadline elapsed before a RESPONSE arrived. The caller emits a CANCEL on timeout so the server can drop the in-flight handler; this variant is returned to the awaiting caller.

Fields

§elapsed_ms: u64

Wall-clock milliseconds elapsed before timeout fired.

§

ServerError

Server returned a non-Ok status. Body carries the server’s diagnostic (UTF-8) when available.

Fields

§status: u16

Wire-level RpcStatus value the server returned.

§message: String

UTF-8 diagnostic from the response body, when the body decodes as valid UTF-8; otherwise hex-truncated.

§

Transport(AdapterError)

Underlying transport error (publish failure, encryption, etc.).

§

Codec

Client-local serialization or deserialization failure. direction = Encode means the typed wrapper failed to encode the request before it ever hit the wire; direction = Decode means the response landed but the typed wrapper failed to decode it. Either way this is a caller-fixable bug (wrong codec, schema drift, malformed Serialize impl) — NOT a transient infra failure — so retry / circuit-breaker predicates skip it by default.

Fields

§direction: CodecDirection

Which side of the call the codec failure happened on.

§message: String

Decode/encode diagnostic from the underlying serde impl.

§

CapabilityDenied

v0.4 capability-auth gate denied the call. Either the target’s latest CapabilityAnnouncement does not list the requested nrpc:<service> tag, or it lists the tag with allow-lists the caller does not match. See docs/plans/CAPABILITY_AUTH_PLAN.md §3 for the model.

Raised by the caller-side gate inside MeshNode::call_service BEFORE the request hits the wire, and surfaced by the caller on receipt of a RpcStatus::CapabilityDenied response (the callee-side defense-in-depth path).

Fields

§target: u64

Target node id the gate denied.

§capability: String

Service / capability tag (without the nrpc: prefix) the gate denied.

§

Cancelled

Caller-side cancellation fired via MeshNode::cancel with the call’s cancel_token. Triggers a Drop-on-cancel CANCEL frame on the wire so the server’s in-flight handler observes the cancel; the awaiting caller returns this variant. NOT retried by the default retry policy — cancellation is caller-driven and re-issuing the call defeats the point.

Trait Implementations§

Source§

impl Debug for RpcError

Source§

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

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

impl Display for RpcError

Source§

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

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

impl Error for RpcError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<AdapterError> for RpcError

Source§

fn from(source: AdapterError) -> Self

Converts to this type from the input type.
Source§

impl From<RpcError> for FoldQueryClientError

Source§

fn from(e: RpcError) -> Self

Converts to this type from the input type.
Source§

impl From<RpcError> for RegistryClientError

Source§

fn from(e: RpcError) -> Self

Converts to this type from the input type.
Source§

impl From<RpcError> for TypedCallError

Source§

fn from(source: RpcError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more