1
0
mirror of https://github.com/fluencelabs/aquavm synced 2025-03-16 04:50:49 +00:00

chore(execution-engine): replace IncompatibleJValueType with more specific FoldIteratesOverNonArray in fold ()

This commit is contained in:
raftedproc 2023-03-09 14:37:39 +03:00 committed by GitHub
parent d28f674cdc
commit 47a7a87925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions
air/src/execution_step
errors
instructions/fold

@ -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.

@ -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());
}
};