From d7a77696bf8ca6b7a8c5c364292544c41fdee3a4 Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Tue, 22 Oct 2024 17:57:25 +0530 Subject: [PATCH] try refactor --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 349d877..db09ae1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -256,17 +256,17 @@ impl ThreadPriorityValue { } impl std::convert::TryFrom for ThreadPriorityValue { - type Error = &'static str; + type Error = String; fn try_from(value: u8) -> Result { if (Self::MIN..=Self::MAX).contains(&value) { Ok(Self(value)) } else { - if cfg!(target_os = "vxworks") { - Err("The value is not in the range of [0;255]") - } else { - Err("The value is not in the range of [0;99]") - } + Err(format!( + "The value is not in the range of [{}; {}]", + Self::MIN, + Self::MAX + )) } } }