From 730ddef33937d8d3c05d04ae28bee5f908d2ad3f Mon Sep 17 00:00:00 2001 From: Taylor Eernisse Date: Fri, 30 Jan 2026 16:54:02 -0500 Subject: [PATCH] fix(error): Remap ConfigNotFound to exit 20 and add NotFound/Ambiguous codes ConfigNotFound previously used exit code 2 which collides with clap's usage error code. Remap it to exit 20 to avoid ambiguity. Also add dedicated NotFound (exit 17) and Ambiguous (exit 18) error codes with proper ErrorCode variants and Display implementations, replacing the previous incorrect mapping of these errors to GitLabNotFound. Co-Authored-By: Claude (us.anthropic.claude-opus-4-5-20251101-v1:0) --- src/core/error.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/error.rs b/src/core/error.rs index b22b476..17795db 100644 --- a/src/core/error.rs +++ b/src/core/error.rs @@ -24,6 +24,8 @@ pub enum ErrorCode { OllamaUnavailable, OllamaModelNotFound, EmbeddingFailed, + NotFound, + Ambiguous, } impl std::fmt::Display for ErrorCode { @@ -45,6 +47,8 @@ impl std::fmt::Display for ErrorCode { Self::OllamaUnavailable => "OLLAMA_UNAVAILABLE", Self::OllamaModelNotFound => "OLLAMA_MODEL_NOT_FOUND", Self::EmbeddingFailed => "EMBEDDING_FAILED", + Self::NotFound => "NOT_FOUND", + Self::Ambiguous => "AMBIGUOUS", }; write!(f, "{code}") } @@ -55,7 +59,7 @@ impl ErrorCode { pub fn exit_code(&self) -> i32 { match self { Self::InternalError => 1, - Self::ConfigNotFound => 2, + Self::ConfigNotFound => 20, Self::ConfigInvalid => 3, Self::TokenNotSet => 4, Self::GitLabAuthFailed => 5, @@ -70,6 +74,8 @@ impl ErrorCode { Self::OllamaUnavailable => 14, Self::OllamaModelNotFound => 15, Self::EmbeddingFailed => 16, + Self::NotFound => 17, + Self::Ambiguous => 18, } } } @@ -174,8 +180,8 @@ impl LoreError { Self::Json(_) => ErrorCode::InternalError, Self::Io(_) => ErrorCode::IoError, Self::Transform(_) => ErrorCode::TransformError, - Self::NotFound(_) => ErrorCode::GitLabNotFound, - Self::Ambiguous(_) => ErrorCode::GitLabNotFound, + Self::NotFound(_) => ErrorCode::NotFound, + Self::Ambiguous(_) => ErrorCode::Ambiguous, Self::Other(_) => ErrorCode::InternalError, Self::OllamaUnavailable { .. } => ErrorCode::OllamaUnavailable, Self::OllamaModelNotFound { .. } => ErrorCode::OllamaModelNotFound,