From 4299e8c65f84f29f09fbcac479e371468bd869c9 Mon Sep 17 00:00:00 2001 From: Patrik Stas Date: Wed, 30 Aug 2023 01:04:59 +0200 Subject: [PATCH] Address code review Signed-off-by: Patrik Stas --- aries_vcx_core/src/anoncreds/credx_anoncreds.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aries_vcx_core/src/anoncreds/credx_anoncreds.rs b/aries_vcx_core/src/anoncreds/credx_anoncreds.rs index 9182857af8..1fc8239a59 100644 --- a/aries_vcx_core/src/anoncreds/credx_anoncreds.rs +++ b/aries_vcx_core/src/anoncreds/credx_anoncreds.rs @@ -169,10 +169,13 @@ impl IndyCredxAnonCreds { attrs.push(Value::Object(restriction)); json!({ "$and": attrs }) } - _ => json!(attrs), + _ => Err(AriesVcxCoreError::from_msg( + AriesVcxCoreErrorKind::InvalidInput, + "Invalid attribute restrictions (must be array or an object)", + ))?, } } else { - json!(attrs) + json!({ "$and": attrs }) }; let wql_query = serde_json::to_string(&wql_query)?; @@ -751,7 +754,7 @@ impl BaseAnonCreds for IndyCredxAnonCreds { .map(|v| v.try_as_str().map(_normalize_attr_name)) .collect::>()?, _ => Err(AriesVcxCoreError::from_msg( - AriesVcxCoreErrorKind::InvalidAttributesStructure, + AriesVcxCoreErrorKind::InvalidInput, "exactly one of 'name' or 'names' must be present", ))?, };