async_ssh2_tokio/
error.rs

1use std::io;
2
3use tokio::sync::mpsc;
4
5/// This is the `thiserror` error for all crate errors.
6///
7/// Most ssh related error is wrapped in the `SshError` variant,
8/// giving access to the underlying [`russh::Error`] type.
9#[derive(thiserror::Error, Debug)]
10#[non_exhaustive]
11pub enum Error {
12    #[error("Keyboard-interactive authentication failed")]
13    KeyboardInteractiveAuthFailed,
14    #[error("No keyboard-interactive response for prompt: {0}")]
15    KeyboardInteractiveNoResponseForPrompt(String),
16    #[error("Key authentication failed")]
17    KeyAuthFailed,
18    #[error("Unable to load key, bad format or passphrase: {0}")]
19    KeyInvalid(russh::keys::Error),
20    #[error("Password authentication failed")]
21    PasswordWrong,
22    #[error("Invalid address was provided: {0}")]
23    AddressInvalid(io::Error),
24    #[error("The executed command didn't send an exit code")]
25    CommandDidntExit,
26    #[error("Server check failed")]
27    ServerCheckFailed,
28    #[error("Ssh error occured: {0}")]
29    SshError(#[from] russh::Error),
30    #[error("Send error")]
31    SendError(#[from] russh::SendError),
32    #[error("Agent auth error")]
33    AgentAuthError(#[from] russh::AgentAuthError),
34    #[error("Failed to connect to SSH agent")]
35    AgentConnectionFailed,
36    #[error("Failed to request identities from SSH agent")]
37    AgentRequestIdentitiesFailed,
38    #[error("SSH agent has no identities")]
39    AgentNoIdentities,
40    #[error("SSH agent authentication failed")]
41    AgentAuthenticationFailed,
42    #[error("SFTP error occured: {0}")]
43    SftpError(#[from] russh_sftp::client::error::Error),
44    #[error("I/O error")]
45    IoError(#[from] io::Error),
46    #[error("Channel send error")]
47    ChannelSendError(#[from] mpsc::error::SendError<Vec<u8>>),
48}