use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("config parse error: {0}")]
ConfigParse(#[from] toml::de::Error),
#[error("yaml error: {0}")]
Yaml(#[from] serde_yaml::Error),
#[error("invalid task file: {0}")]
InvalidTaskFile(String),
#[error("library '{0}' already exists")]
LibraryExists(String),
#[error("library '{0}' not found")]
LibraryNotFound(String),
#[error("no active library; add one with `tasks lib add <name> <path>`")]
NoActiveLibrary,
#[error("task '{0}' not found")]
TaskNotFound(String),
#[error("identifier '{0}' matches multiple tasks; use a longer prefix or the seq number")]
AmbiguousId(String),
#[error("no editor found; set $EDITOR or `editor` in config.toml")]
NoEditor,
#[error("editor '{0}' exited with an error")]
EditorFailed(String),
#[error("edit rejected, file restored: {0}")]
EditRejected(String),
#[error("could not determine home directory")]
NoHomeDir,
}
pub type Result<T> = std::result::Result<T, Error>;