Skip to main content

ClientError

Enum ClientError 

Source
#[non_exhaustive]
pub enum ClientError { Transport(TransportError), Remote(RemoteError), Decode { content_type: Option<String>, message: String, }, Encode { param: &'static str, message: String, }, InvalidName { name: String, reason: NameRefusal, }, ShapeMismatch { path: String, wanted: String, got: String, methods: Vec<String>, }, }
Expand description

Everything that can go wrong on a typed client call — the call failing, never the activation saying no (that is an err item).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Transport(TransportError)

The transport failed. See TransportError.

§

Remote(RemoteError)

The server answered with an error frame: the call failed — no such activation or method, bad params, not authenticated, not allowed, or the method blew up. Typed and exhaustive; match on it.

The frame’s recoverable flag is not carried (RETURNS-1 decision 9): an error frame ends the call either way.

§

Decode

The server’s answer does not fit the method’s declared contract: a data item whose content does not deserialize into the method’s item type, a progress item that does not deserialize into its progress type, or a one-item method that sent no item or more than one. A contract break between client and server (a renamed field, a version skew); it terminates the stream.

Fields

§content_type: Option<String>

The item’s content_type ("tickets.get"), when the transport carried one; the called method’s, when the break is in the count.

§message: String
§

Encode

An argument could not be serialized into the call’s params object, so nothing was sent. A generated client reports this rather than panicking — a panic in a wasm32 consumer is an unrecoverable trap.

Fields

§param: &'static str

The parameter that failed.

§message: String
§

InvalidName

RETURNS-46: a dynamic child’s instance name the service would route elsewhere than to that instance — so nothing was sent. Every call through the instance’s client, and through any client below it, is this, at once.

Fields

§name: String

The name the accessor was given.

§reason: NameRefusal

Why it cannot name an instance.

§

ShapeMismatch

NEST-14: an untyped client made typed (Untyped::typed) against a node that does not serve the typed client’s interface — the methods it serves under another shape, or not at all. Nothing was called.

Fields

§path: String

The node’s dotted path.

§wanted: String

The typed client’s interface hash.

§got: String

The node’s.

§methods: Vec<String>

The client’s methods the node serves otherwise, or not at all.

Implementations§

Source§

impl ClientError

Source

pub fn is_transport(&self) -> bool

true when the failure came from the transport rather than the peer.

Source

pub fn is_remote(&self) -> bool

true when the peer answered with an error frame.

Source

pub fn remote(&self) -> Option<&RemoteError>

The error frame’s RemoteError, when the call failed remotely.

Trait Implementations§

Source§

impl Clone for ClientError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientError

Source§

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

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

impl Display for ClientError

Source§

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

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

impl Error for ClientError

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<RemoteError> for ClientError

Source§

fn from(e: RemoteError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ClientError

Source§

fn from(e: TransportError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ClientError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ClientError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.