use thiserror::Error;
#[derive(Debug, Error)]
pub enum AgentError {
#[error(
"$SSH_AUTH_SOCK is already set ({0}) — another ssh-agent is active.\n\
Refusing to hijack it. To use kovra as your agent, start it in a shell \
with no agent:\n env -u SSH_AUTH_SOCK kovra ssh-agent\n\
then export the printed SSH_AUTH_SOCK in the shells that should use it."
)]
AuthSockAlreadySet(String),
#[error("ssh-agent socket error: {0}")]
Socket(String),
#[error("core error: {0}")]
Core(#[from] kovra_core::CoreError),
#[error("protocol error: {0}")]
Protocol(String),
#[error("io error: {0}")]
Io(String),
}
impl From<std::io::Error> for AgentError {
fn from(e: std::io::Error) -> Self {
AgentError::Io(e.to_string())
}
}