Skip to content

Commit 2901273

Browse files
handle errors properly
1 parent b5f85e7 commit 2901273

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

assets/scripts/bevy_api.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ function on_event()
3434
print(comp.option_usize)
3535
print("\nvec")
3636
-- print(table_to_string(comp.vec_of_usize))
37-
print(comp.vec_of_usize)
3837
comp.vec_of_usize = {42,69,72}
38+
print(comp.vec_of_usize:print_value())
3939
comp.vec_of_usize[1] = 612312312
40-
print(table_to_string(comp.vec_of_usize))
40+
print(comp.vec_of_usize:print_value())
41+
-- print(table_to_string(comp.vec_of_usize))
4142
-- comp.vec_of_usize[1] = 0
4243
-- print(comp.vec_of_usize[2])
4344
-- print(table_to_string(comp.vec_of_usize))

crates/bevy_mod_scripting_core/src/bindings/function/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ impl CallScriptFunction for DynamicFunction<'_> {
182182
.map_err(InteropError::function_call_error)?;
183183

184184
match return_val.try_into_or_boxed::<ScriptValue>() {
185+
Ok(ScriptValue::Error(e)) => {
186+
Err(InteropError::function_interop_error(self.info(), None, e))
187+
}
185188
Ok(v) => Ok(v),
186189
Err(b) => {
187190
let allocator = world.allocator();

crates/bevy_mod_scripting_functions/src/core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe
167167
value,
168168
world.clone(),
169169
)?;
170+
println!("Applying {:?} to {:?}", other, r);
170171

171172
r.try_apply(other.as_partial_reflect()).unwrap();
172173
Ok::<_, InteropError>(())

0 commit comments

Comments
 (0)