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
15    /// There was a failure parsing the message
16    #[error("An invalid message was received: {0}")]
17    InvalidMessage(String),
18
19    /// There was an io::Error communicating with the agent
20    #[error("An error occurred communicating with the agent")]
21    AgentCommunicationError(#[from] std::io::Error),
22
23    /// An operation returned an ssh_key::Error wrapped in this variant.
24    #[error("An ssh key operation failed")]
25    SSHKey(#[from] ssh_key::Error),
26
27    /// There was a failure to decode or encode an SSH key or certificate.
28    #[error("An ssh encoding operation failed")]
29    SSHEncoding(#[from] ssh_encoding::Error),
30
31    /// An operation returned the Failure message from the remote ssh-agent.
32    #[error("The remote ssh agent returned the failure message")]
33    RemoteFailure,
34}