Skip to main content

GitwayError

Struct GitwayError 

Source
pub struct GitwayError { /* private fields */ }
Expand description

The single error type returned by all gitway-lib operations.

Provides is_* predicate methods so callers can branch on error categories without depending on internal representation. A Backtrace is captured automatically; it is rendered via std::fmt::Display when RUST_BACKTRACE=1 is set.

§Predicates

MethodCondition
is_ioUnderlying I/O failure
is_host_key_mismatchServer key does not match pinned fingerprints
is_authentication_failedServer rejected our key
is_no_key_foundNo identity key available
is_key_encryptedKey file needs a passphrase

Implementations§

Source§

impl GitwayError

Source

pub fn host_key_mismatch(fingerprint: impl Into<String>) -> Self

Source

pub fn authentication_failed() -> Self

Source

pub fn no_key_found() -> Self

Source

pub fn invalid_config(message: impl Into<String>) -> Self

Source

pub fn is_io(&self) -> bool

Returns true if this error originated from an I/O failure.

Source

pub fn is_host_key_mismatch(&self) -> bool

Returns true if the server’s host key did not match any pinned fingerprint.

Source

pub fn is_authentication_failed(&self) -> bool

Returns true if the server rejected our public-key authentication attempt.

Source

pub fn is_no_key_found(&self) -> bool

Returns true if no usable identity key was found.

Source

pub fn is_key_encrypted(&self) -> bool

Returns true if a key file was found but requires a passphrase to decrypt.

Source

pub fn fingerprint(&self) -> Option<&str>

Returns the path at which an encrypted key was found, if applicable.

Source

pub fn error_code(&self) -> &'static str

Returns an upper-snake-case error code for structured JSON output (SFRS Rule 5).

CodeExit codeCondition
GENERAL_ERROR1I/O, SSH protocol, or key-parsing failure
USAGE_ERROR2Invalid configuration or bad arguments
NOT_FOUND3No identity key found
PERMISSION_DENIED4Host key mismatch or authentication failure
Source

pub fn exit_code(&self) -> u32

Returns the numeric process exit code for this error (SFRS Rule 2).

CodeMeaning
1General / unexpected error
2Usage error (bad arguments, invalid configuration)
3Not found (no identity key, unknown host)
4Permission denied (authentication failure, host key mismatch)
Source

pub fn hint(&self) -> &'static str

Returns a short diagnostic hint for structured JSON output (SFRS Rule 5).

Trait Implementations§

Source§

impl Debug for GitwayError

Source§

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

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

impl Display for GitwayError

Source§

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

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

impl Error for GitwayError

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<AgentAuthError> for GitwayError

Source§

fn from(e: AgentAuthError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for GitwayError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for GitwayError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for GitwayError

Source§

fn from(e: Error) -> 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> 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V