Improve error messages for method calls expecting only 1 argument
This commit is contained in:
@ -180,7 +180,7 @@ namespace Godot
|
||||
/// static void Trampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
|
||||
/// {
|
||||
/// if (args.Count != 1)
|
||||
/// throw new ArgumentException($"Callable expected {1} arguments but received {args.Count}.");
|
||||
/// throw new ArgumentException($"Callable expected {1} argument but received {args.Count}.");
|
||||
///
|
||||
/// TResult res = ((Func<int, string>)delegateObj)(
|
||||
/// VariantConversionCallbacks.GetToManagedCallback<int>()(args[0])
|
||||
|
||||
@ -19,7 +19,7 @@ public readonly partial struct Callable
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Invalid argument count for invoking callable." +
|
||||
$" Expected {countExpected} arguments, received {countReceived}.",
|
||||
$" Expected {countExpected} argument(s), received {countReceived}.",
|
||||
paramName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ namespace Godot.NativeInterop
|
||||
}
|
||||
case godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS:
|
||||
case godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS:
|
||||
return $"Invalid call to {where}. Expected {error.Expected} arguments.";
|
||||
return $"Invalid call to {where}. Expected {error.Expected} argument(s).";
|
||||
case godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD:
|
||||
return $"Invalid call. Nonexistent {where}.";
|
||||
case godot_variant_call_error_error.GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL:
|
||||
|
||||
Reference in New Issue
Block a user