ssh_agent_client_rs/
error.rs

1//! Error types
2use thiserror::Error;
3
4/// A Result variant with this module's `Error` as its error type
5pub type Result<T> = std::result::Result<T, Error>;
6
7/// This enum represents the different Errors that might be returned
8/// by this crate.
9#[derive(Error, Debug)]
10pub enum Error {
11    /// A message with an unknown type field was received.
12    #[error("Received an unknown message type: {0}")]
13    UnknownMessageType(u8),
14    /// There was a failure parsing the message
15    #[error("An invalid message was received: {0}")]
16    InvalidMessage(String),
17    /// There was an io::Error communicating with the agent
18    #[error("An error occurred communicating with the agent")]
19    AgentCommunicationError(#[from] std::io::Error),
20    /// An operation returned a ssh_key::Error wrapped in this variant.
21    #[error("An ssh key operation failed")]
22    SSHKey(#[from] ssh_key::Error),
23    #[error("An ssh encoding operation failed")]
24    SSHEncoding(#[from] ssh_encoding::Error),
25    #[error("The remote ssh agent returned the failure message")]
26    /// An operation returned the Failure message from the remote ssh-agent.
27    RemoteFailure,
28}