From 294bdf07333ad416ce475045358e94ca2ae59302 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Wed, 30 Oct 2024 12:05:10 +0100 Subject: [PATCH 1/2] Clarify error message on missing fact --- libsysinspect/src/intp/actproc/modfinder.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libsysinspect/src/intp/actproc/modfinder.rs b/libsysinspect/src/intp/actproc/modfinder.rs index 62c6d747..0adf811d 100644 --- a/libsysinspect/src/intp/actproc/modfinder.rs +++ b/libsysinspect/src/intp/actproc/modfinder.rs @@ -118,9 +118,15 @@ impl ModCall { for exp in exp { let fact = Expression::get_by_namespace(resp.data(), &exp.get_fact_namespace()); if !exp.eval(fact.to_owned()) { + let fact = dataconv::to_string(fact).unwrap_or_default(); return ( Some(false), - Some(format!("{} fails with {}", &exp.get_fact_namespace(), dataconv::to_string(fact).unwrap_or_default())), + Some(format!( + "{} {}{}", + &exp.get_fact_namespace(), + if fact.is_empty() { "is missing" } else { "fails as " }, + fact + )), ); } } From babe2f1d3100cbd3e4443f36aa5d48dbe410b8df Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Wed, 30 Oct 2024 12:08:00 +0100 Subject: [PATCH 2/2] Update error msg on a missing fact :-) --- libsysinspect/src/intp/actproc/modfinder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsysinspect/src/intp/actproc/modfinder.rs b/libsysinspect/src/intp/actproc/modfinder.rs index 0adf811d..f3bdea95 100644 --- a/libsysinspect/src/intp/actproc/modfinder.rs +++ b/libsysinspect/src/intp/actproc/modfinder.rs @@ -122,9 +122,9 @@ impl ModCall { return ( Some(false), Some(format!( - "{} {}{}", + "{} fact {}{}", &exp.get_fact_namespace(), - if fact.is_empty() { "is missing" } else { "fails as " }, + if fact.is_empty() { "data was not found" } else { "fails as " }, fact )), );