godot-rust / godot-rust/gdext

Callable not throwing any errors

Open
#1,123 17 comments 0 reactions 0 assignees View on GitHub
c: core c: ffi feature
Dominant language
Rust
Stars
5.2k
Forks
313
Avg merge
12h 16m
Merged PRs (30d)
11

Description

On gdext 0.2.4 this code properly throws errors:

```rust
let instance: Gd = whatever;

// error because function is not defined
instance.call("_not_real", &[]);
// error because function def has a parameter
instance.call("_param_required", &[]);
```

But when using the Callable, all failures are silent:

```rust
let instance: Gd = whatever;

// nothing happens
instance.callable("_not_real").call(&[]);
// nothing happens
instance.callable("_param_required", &[]);
```

I would expect `callable.call()` here to throw the same errors that `instance.call` and gdscript's `Callable().call()` do. It would also be awesome to have a result on callable, though this deviates from gdscript's behavior:

```rust
let Some(callable) = instance.callable("_not_real") else {
println!("method not found!");
return;
};
```

Contributor guide

Open the contributing guide

Research direction

Start by comparing the behavior shown for instance.call("_not_real") and instance.callable("_not_real").call(&[]) in the Rust bindings. Check how missing methods and missing parameters are handled in each path; done means Callable.call reports the same failures as instance.call, with the optional result behavior clarified by the existing API.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.