Skip to content

Commit

Permalink
luau: do proper error handling in map_computed_value() with new Tab…
Browse files Browse the repository at this point in the history
…le::for_each()
  • Loading branch information
jqnatividad committed Nov 23, 2023
1 parent 27691de commit 3c1a3d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cmd/luau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,11 +1285,16 @@ fn map_computedvalue(
record.push_field(if boolean { "true" } else { "false" })
},
Value::Nil => record.push_field(""),
_ => unreachable!("unsupported value type"),
_ => {
return Err(mlua::Error::RuntimeError(format!(
"Unexpected value type returned by provided Luau expression: {v:?}"
)))
},
}
columns_inserted += 1;
if new_column_count > 0 && columns_inserted >= new_column_count {
// we ignore table values more than the number of new columns defined
// we ignore table values more than the number of
// new columns defined, so we return early
return Ok(());
}
Ok(())
Expand Down

0 comments on commit 3c1a3d7

Please sign in to comment.