Skip to content

Commit b322c45

Browse files
author
toasteater
committed
Improve type mismatch error message
With Variant conversion traits becoming derivable, type errors are no longer limited to `VariantType` mismatches. The error message is expanded to be more informative for non-primitive types.
1 parent 5aea829 commit b322c45

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gdnative-core/src/macros.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,11 @@ macro_rules! godot_wrap_method_inner {
502502
let $pname = if let Some(val) = <$pty as $crate::FromVariant>::from_variant(_variant) {
503503
val
504504
} else {
505-
godot_error!("Incorrect argument type {:?} for argument {}",
506-
_variant.get_type(),
507-
offset);
505+
godot_error!("Incorrect argument type for argument #{} ({}: {}). Got VariantType::{:?} (non-primitive types may impose structural checks)",
506+
offset + 1,
507+
stringify!($pname),
508+
stringify!($pty),
509+
_variant.get_type());
508510
return $crate::Variant::new().to_sys();
509511
};
510512

0 commit comments

Comments
 (0)