Skip to content

Panicking in a method will make godot report that the method does not exist #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lilizoey opened this issue May 1, 2023 · 1 comment
Labels
bug c: register Register classes, functions and other symbols to GDScript

Comments

@lilizoey
Copy link
Member

lilizoey commented May 1, 2023

Using this code:

use godot::prelude::*;

#[derive(GodotClass)]
#[class(init, base=Node)]
pub struct Mini {
    #[base]
    base: Base<Node>,
}

#[godot_api]
impl Mini {
    #[func]
    fn bar(&self) {
        panic!("error")
    }
}

struct Testing;

#[gdextension]
unsafe impl ExtensionLibrary for Testing {}

if you attempt to call bar from gdscript, Godot will report that the method does not exist at runtime:
Screenshot_20230501_021644

However it will also properly report the error we print:
Screenshot_20230501_021711

Note that this does not seem to have any impact outside of run-time.

@lilizoey lilizoey added bug c: ffi Low-level components and interaction with GDExtension API and removed c: ffi Low-level components and interaction with GDExtension API labels May 1, 2023
@lilizoey lilizoey changed the title Panicking in a method will cause godot to believe the method does not exist Panicking in a method will make godot report that the method does not exist May 1, 2023
@Bromeon Bromeon added the c: register Register classes, functions and other symbols to GDScript label May 1, 2023
@Bromeon
Copy link
Member

Bromeon commented Jun 13, 2023

If Godot interprets failed functions calls as "function does not exist", is there realistically something that we can do on our side?

Should we just let the call succeed but still print an error? But then we'd need to return something fitting the signature... and this might have other negative effects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug c: register Register classes, functions and other symbols to GDScript
Projects
None yet
Development

No branches or pull requests

2 participants