From 5d9bee1197d1fbb764beab5ecdc7fc97252f7b33 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Thu, 2 Oct 2025 15:03:20 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(error):=20enhance=20error=20ha?= =?UTF-8?q?ndling=20for=20configuration=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add specific error variants for unset directory, home expansion failure, and directory creation failure - improve error reporting by providing more context in error messages --- src/error.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 360bcfa..02f1e44 100644 --- a/src/error.rs +++ b/src/error.rs @@ -3,10 +3,23 @@ use thiserror::Error; /// Error messages for cull-gmail #[derive(Debug, Error)] pub enum Error { + /// Configuration directory not set + #[error("Configuration directory not set")] + DirectoryUnset, + /// Expansion of home directory in `{0}` failed + #[error("Expansion of home directory in `{0}` failed")] + HomeExpansionFailed(String), + /// Directory creation failed for `{0}` + #[error("Directory creation failed for `{0:?}`")] + DirectoryCreationFailed((String, Box)), /// Error from the google_gmail1 crate - #[error("Google Gmail1 says: {0}")] - GoogleGmail1(#[from] google_gmail1::Error), - /// Error from the google_clis_common crate - #[error("Google CLIs Common says: {0}")] - InvalidOptionsError(google_clis_common::CLIError, i16), + // #[error("Google Gmail1 says: {0}")] + #[error(transparent)] + GoogleGmail1(#[from] Box), + // /// Error from the google_clis_common crate + // #[error("Google CLIs Common says: {0}")] + // InvalidOptionsError(google_clis_common::CLIError, i16), + // /// Other error + // #[error("Error reported: {0}")] + // Other(#[from] String), }