Author:
Hash:
Timestamp:
+12 -4 +/-2 browse
Kevin Schoon [me@kevinschoon.com]
c83ec1ac892d38758d0446a59a5fba20ef97d08a
Wed, 08 Jul 2026 10:30:29 +0000 (1 week ago)
| 1 | diff --git a/ayllu-shell/src/error.rs b/ayllu-shell/src/error.rs |
| 2 | index 88e6054..c4d5491 100644 |
| 3 | --- a/ayllu-shell/src/error.rs |
| 4 | +++ b/ayllu-shell/src/error.rs |
| 5 | @@ -1,5 +1,9 @@ |
| 6 | + use std::path::PathBuf; |
| 7 | + |
| 8 | #[derive(Debug, thiserror::Error)] |
| 9 | pub enum Error { |
| 10 | + #[error("Configuration: {0}")] |
| 11 | + Configuration(#[from] ayllu_config::Error), |
| 12 | #[error("Git: {0}")] |
| 13 | Git(#[from] ayllu_git::Error), |
| 14 | #[error("Io: {0}")] |
| 15 | @@ -8,6 +12,8 @@ pub enum Error { |
| 16 | Menu(#[from] dialoguer::Error), |
| 17 | #[error("Uninitialized field: {0}")] |
| 18 | Uninitialized(#[from] derive_builder::UninitializedFieldError), |
| 19 | + #[error("Cannot find repository: {0}")] |
| 20 | + NotFound(PathBuf), |
| 21 | #[error("Reset")] |
| 22 | #[allow(dead_code)] |
| 23 | Reset, |
| 24 | diff --git a/ayllu-shell/src/main.rs b/ayllu-shell/src/main.rs |
| 25 | index 0a53b3a..713edf7 100644 |
| 26 | --- a/ayllu-shell/src/main.rs |
| 27 | +++ b/ayllu-shell/src/main.rs |
| 28 | @@ -1,11 +1,13 @@ |
| 29 | use ayllu_cmd::shell::{Command, Subcommand}; |
| 30 | use ayllu_git::Wrapper; |
| 31 | |
| 32 | + use crate::error::Error; |
| 33 | + |
| 34 | mod config; |
| 35 | mod error; |
| 36 | mod ui; |
| 37 | |
| 38 | - fn execute(args: Command) -> Result<(), Box<dyn std::error::Error>> { |
| 39 | + fn execute(args: Command) -> Result<(), Error> { |
| 40 | let config: config::Config = ayllu_config::Reader::load(args.config.as_deref())?; |
| 41 | let username = args |
| 42 | .username |
| 43 | @@ -41,7 +43,7 @@ fn execute(args: Command) -> Result<(), Box<dyn std::error::Error>> { |
| 44 | repository.receive_pack()?; |
| 45 | } |
| 46 | None => { |
| 47 | - return Err(format!("Cannot find repository: {resolved:?}").into()); |
| 48 | + return Err(Error::NotFound(resolved)); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | @@ -65,7 +67,7 @@ fn execute(args: Command) -> Result<(), Box<dyn std::error::Error>> { |
| 53 | repository.upload_pack()?; |
| 54 | } |
| 55 | None => { |
| 56 | - return Err(format!("Cannot find repository: {resolved:?}").into()); |
| 57 | + return Err(Error::NotFound(resolved.clone())); |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | @@ -80,7 +82,7 @@ fn execute(args: Command) -> Result<(), Box<dyn std::error::Error>> { |
| 62 | } |
| 63 | |
| 64 | // TODO: Add RBAC style permissions per identity |
| 65 | - fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 66 | + fn main() -> Result<(), Error> { |
| 67 | // eprintln!("Args: {:?}", std::env::args()); |
| 68 | let args = ayllu_cmd::parse::<Command>(); |
| 69 | if let Some(cmd) = args.c { |