How to print an error message in GDExtension

Godot Version

4.7

Question

I’m implementing the _set() method for a custom Resource in GDExtension. I’m validating the data and want to be able to print an error message if invalid data is sent to this method. What’s the right way to do this?

If you are using godot-cpp UtilityFunctions has a few, the classic print of course, push_warning, and push_error will appear in the debugger.

UtilityFunctions::push_warning("My warning! ", error_code)