Improve error messaged when parsing IPs for iphash_to_cpu/Python

Display the offending string as well as the general "Class id must
be in the format (major):(minor), e.g. 1:12.

May help with diagnosing #239 (since "Error: Class id..." is the
only visible error message.
This commit is contained in:
Herbert Wolverson
2023-02-15 15:24:11 +00:00
parent f8f438e8d7
commit 54d9fa99a5
2 changed files with 2 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ fn parse_add_ip(
) -> Result<BusRequest> {
if !classid.contains(':') {
return Err(Error::msg(
"Class id must be in the format (major):(minor), e.g. 1:12",
format!("Class id must be in the format (major):(minor), e.g. 1:12. Provided string: {classid}"),
));
}
Ok(BusRequest::MapIpToFlow {

View File

@@ -93,7 +93,7 @@ fn parse_add_ip(
//}
if !classid.contains(':') {
return Err(Error::msg(
"Class id must be in the format (major):(minor), e.g. 1:12",
format!("Class id must be in the format (major):(minor), e.g. 1:12. Provided string: {classid}"),
));
}
Ok(BusRequest::MapIpToFlow {