godotengine / godotengine/godot

Return an error when calling the callv function

Open
#103,804 3 comments 0 reactions 0 assignees View on GitHub
discussion enhancement topic:core
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.4, 4.3, 4.2, 4.1, 4.0 stable

### System information

Windows 11, Linux Ubuntu 22.04

### Issue description

I know that when Godot makes an error, execution continues so as not to crash the editor.

However, I am having an error when calling a callv function.

An error occurs if the parameters are not correct, but then you are clearly passing the wrong values ​​to Callv! And the answer is yes!
But this can happen at the user level too! How come?

I am developing an MMORPG template for Godot, and in tests with friends who are also GDScript programmers, one of these testers managed to revert the compilation of the client and managed to send the wrong parameters to the server, causing the server to have several errors in Callv.

So I believe that this can be solved by adding an error return to Callv, something like:

try_callv(args)

returning OK or !OK if the parameters are incorrect, either in quantity or type.

In fact, I can see many benefits in adding this try_callv or even returning [ERROR, VARIANT] to what we already have today, which is returning a variant.

`
[OK or FAILED, fn_result] try_callv()
`

![Image](https://github.com/user-attachments/assets/6a6ea60a-7117-47b7-90da-37f8237c3182)

### Steps to reproduce

callv.zip

### Minimal reproduction project (MRP)

[callv.zip](https://github.com/user-attachments/files/19143696/callv.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached callv.zip minimal reproduction and review the existing callv behavior described in the issue. Determine the intended error-reporting API for incorrect argument counts or types, and validate that the proposed behavior preserves the current return value for successful calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.