cargo_setupx/
error.rs

1//! Error types for cargo-setupx
2
3use std::io;
4use std::path::PathBuf;
5use thiserror::Error;
6
7/// Result type alias for cargo-setupx operations
8pub type Result<T> = std::result::Result<T, SetupError>;
9
10/// Errors that can occur during project setup
11#[derive(Error, Debug)]
12pub enum SetupError {
13    /// I/O error occurred
14    #[error("I/O error: {0}")]
15    Io(#[from] io::Error),
16
17    /// File already exists and force flag not set
18    #[error("File already exists: {path}. Use --force to overwrite")]
19    FileExists { path: PathBuf },
20
21    /// Invalid architecture type
22    #[error("Invalid architecture type: '{0}'. Currently supported: 'clean'")]
23    InvalidArchitecture(String),
24
25    /// Git operation failed
26    #[error("Git operation failed: {0}")]
27    Git(String),
28
29    /// Generic error
30    #[error("{0}")]
31    Other(String),
32}