Skip to content

Commit a2a5c01

Browse files
authored
Properly handle calls with invalid arguments (#23)
1 parent 447f892 commit a2a5c01

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

derive/src/impl_attribute.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ pub fn godot_script_impl(
7171

7272
quote_spanned! {
7373
arg.span() =>
74-
#godot_types::prelude::FromGodot::from_variant(
74+
#godot_types::prelude::FromGodot::try_from_variant(
7575
args.get(#index).ok_or(#godot_types::sys::GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS)?
76-
)
76+
).map_err(|err| {
77+
#godot_types::log::godot_error!("failed to convert variant: {}", err);
78+
#godot_types::sys::GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT
79+
})?
7780
}
7881
)
7982
})

0 commit comments

Comments
 (0)