Add GDExtension print_script_error and print_script_error_with_message - #121199
Add GDExtension print_script_error and print_script_error_with_message#121199Naros wants to merge 1 commit into
print_script_error and print_script_error_with_message#121199Conversation
dsnopek
left a comment
There was a problem hiding this comment.
Thanks!
The changes to the gdextension_interface.json look good, and match print_error and print_warning. However, this is missing the actual implementation in gdextension_interface.cpp
There was a problem hiding this comment.
The functions already exist on master. This PR duplicates them -- so it shouldn't be needed.
CI was skipped, would it catch duplicates?
| { | ||
| "name": "print_script_error", | ||
| "arguments": [ | ||
| { | ||
| "name": "p_description", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The code triggering the error." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_function", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The function name where the error occurred." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_file", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The file where the error occurred." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_line", | ||
| "type": "int32_t", | ||
| "description": [ | ||
| "The line where the error occurred." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_editor_notify", | ||
| "type": "GDExtensionBool", | ||
| "description": [ | ||
| "Whether or not to notify the editor." | ||
| ] | ||
| } | ||
| ], | ||
| "description": [ | ||
| "Logs a script error to Godot's built-in debugger and to the OS terminal." | ||
| ], | ||
| "since": "4.8" | ||
| }, | ||
| { | ||
| "name": "print_script_error_with_message", | ||
| "arguments": [ | ||
| { | ||
| "name": "p_description", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The code triggering the error." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_message", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The message to show along with the error." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_function", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The function name where the error occurred." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_file", | ||
| "type": "const char*", | ||
| "description": [ | ||
| "The file where the error occurred." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_line", | ||
| "type": "int32_t", | ||
| "description": [ | ||
| "The line where the error occurred." | ||
| ] | ||
| }, | ||
| { | ||
| "name": "p_editor_notify", | ||
| "type": "GDExtensionBool", | ||
| "description": [ | ||
| "Whether or not to notify the editor." | ||
| ] | ||
| } | ||
| ], | ||
| "description": [ | ||
| "Logs a script error with a message to Godot's built-in debugger and to the OS terminal." | ||
| ], | ||
| "since": "4.8" | ||
| }, |
There was a problem hiding this comment.
These are already on master, at (now) position 14 and 15.
The ones added in this PR are at position 10 and 11 in the same array.
godot/core/extension/gdextension_interface.json
Lines 4072 to 4166 in fb18213
There was a problem hiding this comment.
Good catch! I didn't recall having these methods
I don't know if CI would have caught it. The JSON parser may have just had the second one overwrite the first?
There was a problem hiding this comment.
So, we don't see this because of the CI-skipped issue 🤡
I attempted to fix the skip in #121734.
The original duplication might cause a compile error, but different C/C++ compiler versions may be lenient to identical typedefs. To be on the safe side (also in presence of toolchain changes) I also opened #121733.
|
So this can be closed, no? |
|
Yes, I think so |
What problem(s) does this PR solve?
This adds the GDExtension JSON mapping for
print_script_errorandprint_script_error_with_messagebindings that we are planning to add on godot-cpp side.Additional information
This is from a RChat discussion we had about the fact there is no way for scripting extensions written in GDExtension to use ERR_HANDLER_SCRIPT to report script-specific errors like GDScript does. This exposes the already present methods in gdextension_interface.cpp to the godot-cpp bindings.
This is needed for godotengine/godot-cpp#2022