use thiserror::Error;
#[derive(Error, Debug)]
pub enum PwrError {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("TOML parse error in {path}: {source}")]
TomlParse {
path: String,
#[source]
source: toml::de::Error,
},
#[error("TOML serialize error: {0}")]
TomlSerialize(#[from] toml::ser::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Bincode error: {0}")]
Bincode(#[from] bincode::error::EncodeError),
#[error("Config error: {0}")]
Config(String),
#[error("No config found — run `pwr init` first")]
NoConfig,
#[error("Protocol framing error: {0}")]
Framing(String),
#[error("Protocol error: {0}")]
Protocol(String),
#[error("Crypto error: {0}")]
Crypto(String),
#[error("Authentication failed: {0}")]
Auth(String),
#[error("Network error: {0}")]
Network(String),
#[error("Timeout: {0}")]
Timeout(String),
#[error("Project not found: {0}")]
NotFound(String),
#[error("Project already exists: {0}")]
AlreadyExists(String),
#[error("Corrupted project data: {0}")]
Corrupted(String),
#[error("UUID error: {0}")]
Uuid(#[from] uuid::Error),
}
pub type Result<T> = std::result::Result<T, PwrError>;