Skip to main content

ConnectError

Enum ConnectError 

Source
#[non_exhaustive]
pub enum ConnectError { Connect { path: PathBuf, source: Error, }, Io(Error), Wire(WireError), HandshakeClosed, HandshakeTimeout { after: Duration, }, ProtocolMismatch { client: u32, daemon_version: Option<String>, message: String, }, Destination(DestinationError), Ssh { destination: String, cause: SshCause, }, }
Expand description

Why Connection::open failed.

Non-exhaustive: expect more variants.

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

Connect

connect(2) itself failed: nothing is listening at path (no socket file, permission denied, connection refused, …).

Fields

§path: PathBuf

The socket path that was dialed.

§source: Error

The OS error connect returned.

§

Io(Error)

A framed read or write failed after the connection was established.

§

Wire(WireError)

The Hello failed to encode, or the reply frame failed to decode.

§

HandshakeClosed

The peer closed the connection before a HelloReply arrived.

§

HandshakeTimeout

Connect succeeded but no HelloReply (and no close) arrived within the timeout. Distinct from Self::Connect: a refusal means nothing is listening, a timeout means something is bound but not answering.

Fields

§after: Duration

The timeout that was exceeded.

§

ProtocolMismatch

The daemon refused the handshake on protocol-version skew. client is this client’s own PROTOCOL_VERSION; message is the daemon’s own sentence, not meant for parsing.

Fields

§client: u32

This client’s own protocol version.

§daemon_version: Option<String>

The daemon’s own crate version, when it named one.

None from a daemon built before this field existed. Read it as unknown rather than assuming either side is the older build.

§message: String

The daemon’s refusal message, verbatim.

§

Destination(DestinationError)

The destination handed to Client::connect_ssh_with is not one Destination::parse accepts. Nothing was spawned.

§

Ssh

Dialling destination through ssh failed; cause says how.

Fields

§destination: String

The destination that was dialled.

§cause: SshCause

What went wrong, on this side or the far one.

Implementations§

Source§

impl ConnectError

Source

pub const fn exit_code(&self) -> u8

The shep_core::exit code a process stopping on this error uses: a refusal is a protocol mismatch, a destination ssh would misread is a usage error, and every other stage is nothing usable answering.

Trait Implementations§

Source§

impl Debug for ConnectError

Source§

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

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

impl Display for ConnectError

Source§

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

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

impl Error for ConnectError

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<ConnectError> for ShepherdError

Source§

fn from(err: ConnectError) -> 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, 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> 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.