diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..48a5f40 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,20 @@ +#[derive(Debug, thiserror::Error)] +pub enum Error { + // Domain errors + #[error("Invalid scope: {0}")] + InvalidScope(String), + #[error("Invalid description: {0}")] + InvalidDescription(String), + // Infrastructure errors + #[error("Not a Jujutsu repository")] + NotARepository, + #[error("jj is not installed or not in PATH")] + JjNotFound, + #[error("jj command failed: {message}")] + JjCommand { message: String, stderr: String }, + // Application errors + #[error("Operation cancelled by user")] + Cancelled, + #[error("Non-interactive terminal detected")] + NonInteractive +} diff --git a/src/lib.rs b/src/lib.rs index 0e15477..1b4308e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,3 +2,4 @@ mod cli; mod commit; mod jj; mod prompts; +mod error;