diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-05-28 23:11:37 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-06-15 16:20:01 +0200 |
commit | cceeb671db82c06ebcd3323065672e11a1613431 (patch) | |
tree | e67462e4046ad3d0b7ff115065c2ddbffd6eba7d /modules | |
parent | 68b86220c806fa02d0d2b21d6561e7ea871e840e (diff) | |
download | redot-engine-cceeb671db82c06ebcd3323065672e11a1613431.tar.gz |
Improve stack overflow error message in GDScript and VisualScript
Stack overflow errors are generally the result of infinite recursion
within a script.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript.h | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script.cpp | 4 | ||||
-rw-r--r-- | modules/visual_script/visual_script.h | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 80f187a375..0057962d5e 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -368,7 +368,7 @@ public: if (_debug_call_stack_pos >= _debug_max_call_stack) { //stack overflow - _debug_error = "Stack Overflow (Stack Size: " + itos(_debug_max_call_stack) + ")"; + _debug_error = vformat("Stack overflow (stack size: %s). Check for infinite recursion in your script.", _debug_max_call_stack); EngineDebugger::get_script_debugger()->debug(this); return; } diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 30b64d0a7b..c4fafb6676 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1582,7 +1582,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p if (!found) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; - error_str = RTR("Found sequence bit but not the node in the stack, report bug!"); + error_str = RTR("Found sequence bit but not the node in the stack (please report)."); error = true; break; } @@ -1594,7 +1594,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p // Check for stack overflow. if (flow_stack_pos + 1 >= flow_max) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; - error_str = RTR("Stack overflow with stack depth:") + " " + itos(output); + error_str = vformat(RTR("Stack overflow (stack size: %s). Check for infinite recursion in your script."), output); error = true; break; } diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 0f3b8de3fc..c2e4d0e597 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -522,7 +522,7 @@ public: if (_debug_call_stack_pos >= _debug_max_call_stack) { // Stack overflow. - _debug_error = "Stack Overflow (Stack Size: " + itos(_debug_max_call_stack) + ")"; + _debug_error = vformat("Stack overflow (stack size: %s). Check for infinite recursion in your script.", _debug_max_call_stack); EngineDebugger::get_script_debugger()->debug(this); return; } @@ -545,7 +545,7 @@ public: } if (_debug_call_stack_pos == 0) { - _debug_error = "Stack Underflow (Engine Bug)"; + _debug_error = "Stack underflow (engine bug), please report."; EngineDebugger::get_script_debugger()->debug(this); return; } |