From 1be66eebebaa3a5849399433ad5823345668ffb1 Mon Sep 17 00:00:00 2001 From: orhun Date: Sun, 20 Jun 2021 22:24:38 +0300 Subject: [PATCH] refactor(error): use custom error message for GroupError --- git-cliff-core/src/commit.rs | 8 ++++++-- git-cliff-core/src/error.rs | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/git-cliff-core/src/commit.rs b/git-cliff-core/src/commit.rs index c767260667..4ecd20d4e9 100644 --- a/git-cliff-core/src/commit.rs +++ b/git-cliff-core/src/commit.rs @@ -96,7 +96,9 @@ impl Commit<'_> { self.group = parser.group.as_ref().cloned(); return Ok(self); } else { - return Err(AppError::GroupError); + return Err(AppError::GroupError(String::from( + "Skipping commit", + ))); } } } @@ -104,7 +106,9 @@ impl Commit<'_> { if !filter { Ok(self) } else { - Err(AppError::GroupError) + Err(AppError::GroupError(String::from( + "Commit does not belong to any group", + ))) } } } diff --git a/git-cliff-core/src/error.rs b/git-cliff-core/src/error.rs index 7698feebde..c75a8120a5 100644 --- a/git-cliff-core/src/error.rs +++ b/git-cliff-core/src/error.rs @@ -16,9 +16,9 @@ pub enum Error { /// error. #[error("Cannot parse the commit: `{0}`")] ParseError(#[from] git_conventional::Error), - /// When commit's not belong to any group we throw this error. - #[error("Commit does not belong to any group")] - GroupError, + /// Error that may occur while grouping commits. + #[error("Grouping error: `{0}`")] + GroupError(String), /// Error that may occur while template operations such as parse and render. #[error("Template error: `{0}`")] TemplateError(#[from] tera::Error),