From eb238c4774701a2f05e10fccf5223c3b18ff21a8 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 16 May 2025 17:18:04 +0100 Subject: [PATCH] Make GroupsPathError and MetadataRetrievalError enums non-exhaustive --- cpp/src/error.rs | 4 ++-- python/src/error.rs | 2 +- src/database/error.rs | 1 + src/sorting/error.rs | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/src/error.rs b/cpp/src/error.rs index c2fba11f..07545cdc 100644 --- a/cpp/src/error.rs +++ b/cpp/src/error.rs @@ -140,7 +140,7 @@ impl From for VerboseError { match value { GroupsPathError::UndefinedGroup(g) => Self::UndefinedGroupError(g), GroupsPathError::CycleFound(cycle) => Self::CyclicInteractionError(cycle), - GroupsPathError::PathfindingError(_) => Self::Other(Box::new(value)), + GroupsPathError::PathfindingError(_) | _ => Self::Other(Box::new(value)), } } } @@ -149,7 +149,7 @@ impl From for VerboseError { fn from(value: MetadataRetrievalError) -> Self { match value { MetadataRetrievalError::ConditionEvaluationError(e) => e.into(), - MetadataRetrievalError::RegexError(_) => Self::Other(Box::new(value)), + MetadataRetrievalError::RegexError(_) | _ => Self::Other(Box::new(value)), } } } diff --git a/python/src/error.rs b/python/src/error.rs index b0b8f864..aca857eb 100644 --- a/python/src/error.rs +++ b/python/src/error.rs @@ -68,7 +68,7 @@ impl From for VerboseError { match value { GroupsPathError::UndefinedGroup(g) => Self::UndefinedGroupError(g), GroupsPathError::CycleFound(cycle) => Self::CyclicInteractionError(cycle), - GroupsPathError::PathfindingError(_) => Self::Other(Box::new(value)), + GroupsPathError::PathfindingError(_) | _ => Self::Other(Box::new(value)), } } } diff --git a/src/database/error.rs b/src/database/error.rs index 74d1b83f..7e688687 100644 --- a/src/database/error.rs +++ b/src/database/error.rs @@ -24,6 +24,7 @@ impl From for ConditionEvaluationError { /// Represents an error that occurred while retrieving metadata for a plugin. #[derive(Debug)] +#[non_exhaustive] pub enum MetadataRetrievalError { ConditionEvaluationError(ConditionEvaluationError), RegexError(RegexError), diff --git a/src/sorting/error.rs b/src/sorting/error.rs index 4c37b4da..4161eca8 100644 --- a/src/sorting/error.rs +++ b/src/sorting/error.rs @@ -66,6 +66,7 @@ pub(crate) fn display_cycle(cycle: &[Vertex]) -> String { /// Represents an error that occurred while trying to get the path between two /// groups across the graph formed from group metadata. #[derive(Debug)] +#[non_exhaustive] pub enum GroupsPathError { UndefinedGroup(String), CycleFound(Vec),