mitoxide_ssh/
error.rs

1//! SSH-specific error types
2
3use thiserror::Error;
4use std::io;
5
6/// Transport-specific errors
7#[derive(Debug, Error)]
8pub enum TransportError {
9    /// SSH connection error
10    #[error("SSH connection error: {0}")]
11    Connection(String),
12    
13    /// Bootstrap error
14    #[error("Bootstrap error: {0}")]
15    Bootstrap(String),
16    
17    /// Authentication error
18    #[error("Authentication failed: {0}")]
19    Authentication(String),
20    
21    /// I/O error
22    #[error("I/O error: {0}")]
23    Io(#[from] io::Error),
24    
25    /// Timeout error
26    #[error("Operation timed out")]
27    Timeout,
28    
29    /// Protocol error
30    #[error("Protocol error: {0}")]
31    Protocol(String),
32    
33    /// Configuration error
34    #[error("Configuration error: {0}")]
35    Configuration(String),
36    
37    /// Remote command failed
38    #[error("Remote command failed with exit code {code}: {message}")]
39    CommandFailed { 
40        /// Exit code of the failed command
41        code: i32, 
42        /// Error message
43        message: String 
44    },
45}