Skip to main content

AutosshError

Enum AutosshError 

Source
#[non_exhaustive]
pub enum AutosshError { SshNotFound { searched: Vec<PathBuf>, }, MonitorBindFailed { port: u16, source: Error, }, MaxStartReached { attempts: u32, }, MaxLifetimeReached, PidfileWrite { path: PathBuf, source: Error, }, LogfileWrite { path: PathBuf, source: Error, }, Io(Error), Daemonize { reason: String, }, Internal(&'static str), }
Expand description

Errors returned by the rusty-autossh library API.

Send + Sync + 'static per SC-009. #[non_exhaustive] per AD-014 so additive variants are not a breaking change.

source() returns the wrapped inner error for wrapping variants (those holding a source: io::Error field, the #[from] Io variant) and None for leaf variants (no inner source).

§Example

use std::io;
use rusty_autossh::AutosshError;

// io::Error converts via `#[from]` (AD-014).
let io_err = io::Error::new(io::ErrorKind::NotFound, "boom");
let err: AutosshError = io_err.into();
match err {
    AutosshError::Io(_) => {}
    _ => unreachable!(),
}

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

SshNotFound

The ssh binary could not be resolved from AUTOSSH_PATH or any entry in the host PATH. The searched field enumerates the directories probed (in walk order) for diagnostic surfacing.

Fields

§searched: Vec<PathBuf>

Directories probed during the PATH walk (or the verbatim AUTOSSH_PATH value when that env var was set).

§

MonitorBindFailed

Failed to bind a monitor-port tokio::net::TcpListener on 127.0.0.1:<port> (typically EADDRINUSE or a permission error).

Fields

§port: u16

The TCP port that failed to bind.

§source: Error

Underlying OS error.

§

MaxStartReached

The consecutive-retry counter reached the AUTOSSH_MAXSTART cap (or --max-start <n> CLI override). Maps to upstream’s autossh: maximum retries reached stderr.

Fields

§attempts: u32

Number of consecutive child-spawn attempts performed before the cap was hit.

§

MaxLifetimeReached

AUTOSSH_MAXLIFETIME (or --max-lifetime <secs>) elapsed. Clean self-termination; supervisor exits 0.

§

PidfileWrite

Atomic write of the pidfile failed at startup.

Fields

§path: PathBuf

Pidfile path that failed to write.

§source: Error

Underlying OS error.

§

LogfileWrite

Failed to open/append to the logfile.

Fields

§path: PathBuf

Logfile path that failed to write.

§source: Error

Underlying OS error.

§

Io(Error)

Generic I/O error surfaced from underlying syscalls.

§

Daemonize

The daemonize crate or Windows CreateProcessW self-respawn failed during -f background mode setup.

Fields

§reason: String

Human-readable reason for the daemonize failure.

§

Internal(&'static str)

An internal invariant was violated. The &'static str payload is a short diagnostic tag (never user-supplied content).

Trait Implementations§

Source§

impl Debug for AutosshError

Source§

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

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

impl Display for AutosshError

Source§

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

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

impl Error for AutosshError

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<Error> for AutosshError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<StrictError> for AutosshError

Source§

fn from(_err: StrictError) -> 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 = 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.