From 47a7a8792592ec2937b21fdaa326ff9371d8eeca Mon Sep 17 00:00:00 2001 From: raftedproc <71657594+raftedproc@users.noreply.github.com> Date: Thu, 9 Mar 2023 14:37:39 +0300 Subject: [PATCH] chore(execution-engine): replace IncompatibleJValueType with more specific FoldIteratesOverNonArray in fold (#502) --- air/src/execution_step/errors/catchable_errors.rs | 2 +- air/src/execution_step/instructions/fold/utils.rs | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/air/src/execution_step/errors/catchable_errors.rs b/air/src/execution_step/errors/catchable_errors.rs index d510c736..b50bc327 100644 --- a/air/src/execution_step/errors/catchable_errors.rs +++ b/air/src/execution_step/errors/catchable_errors.rs @@ -55,7 +55,7 @@ pub enum CatchableError { }, /// A fold instruction must iterate over array value. - #[error("lambda '{1}' returned non-array value '{0}' for fold instruction")] + #[error("expression '{1}' returned non-array value '{0}' for a fold iterable")] FoldIteratesOverNonArray(JValue, String), /// This error type is produced by a match to notify xor that compared values aren't equal. diff --git a/air/src/execution_step/instructions/fold/utils.rs b/air/src/execution_step/instructions/fold/utils.rs index 8e8b3dcf..b4b21875 100644 --- a/air/src/execution_step/instructions/fold/utils.rs +++ b/air/src/execution_step/instructions/fold/utils.rs @@ -126,12 +126,7 @@ fn from_value(call_result: ValueAggregate, variable_name: &str) -> ExecutionResu array.len() } v => { - return Err(CatchableError::IncompatibleJValueType { - variable_name: variable_name.to_string(), - actual_value: (*v).clone(), - expected_value_type: "array", - } - .into()); + return Err(CatchableError::FoldIteratesOverNonArray((*v).clone(), variable_name.to_string()).into()); } };