From 363deb01b4ca9ad32aef720aee1e2f80bf2f9e07 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 5 Apr 2024 09:45:03 +0300 Subject: [PATCH] fix: maded panic messages more clear --- src/keyword.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/keyword.rs b/src/keyword.rs index 313e9f5..50838a6 100644 --- a/src/keyword.rs +++ b/src/keyword.rs @@ -127,16 +127,16 @@ impl Keyword { let float_exists = float.is_some() as u8; let str_exists = str.is_some() as u8; - // EXPLANATION: if at least two values is exists then we stop execution. + // EXPLANATION: if at least two types of value is exists then we stop execution. if int_exists + float_exists + str_exists > 1 { - panic!("The option have more than one type together! Please open an issue!") + panic!("Expected single value type, but received more than one! Please open an issue with the information: Option {{ option: {option}, int: {int:?}, float: {float:?}, str: {str:?}, set: {set} }}!") } let value = match (int, float, str) { (Some(int), _, _) => OptionValue::Int(int), (_, Some(float), _) => OptionValue::Float(float), (_, _, Some(str)) => OptionValue::String(str), - _ => panic!("Unrecognized option value! Please open issue!"), + (int, float, str) => panic!("Expected either an 'int', a 'float' or a 'str', but none of them is not received! Please open an issue with the information: Option {{ option: {option}, int: {int:?}, float: {float:?}, str: {str:?}, set: {set} }}!"), }; Keyword { option, value, set }