use std::time::Duration;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum InitError {
#[error("TCP connection to {host}:{port} failed: {reason}")]
TcpFailed {
host: String,
port: u16,
reason: String,
},
#[error("HTTP request to {url} failed: {reason}")]
HttpFailed { url: String, reason: String },
#[error("Command '{command}' failed with exit code {code}")]
CommandFailed {
command: String,
code: i32,
stdout: String,
stderr: String,
},
#[error("Timeout exceeded: {timeout:?}")]
Timeout { timeout: Duration },
#[error("Unknown init action: {0}")]
UnknownAction(String),
#[error("Invalid parameters for action '{action}': {reason}")]
InvalidParams { action: String, reason: String },
#[cfg(feature = "s3")]
#[error("S3 operation failed for {bucket}/{key}: {reason}")]
S3Failed {
bucket: String,
key: String,
reason: String,
},
}
pub type Result<T, E = InitError> = std::result::Result<T, E>;