Skip to content

Commit

Permalink
chore(execution-engine): replace IncompatibleJValueType with more spe…
Browse files Browse the repository at this point in the history
…cific FoldIteratesOverNonArray in fold
  • Loading branch information
raftedproc committed Mar 8, 2023
1 parent 56d3ab2 commit cc178bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion air/src/execution_step/errors/catchable_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 1 addition & 6 deletions air/src/execution_step/instructions/fold/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
};

Expand Down

0 comments on commit cc178bd

Please sign in to comment.