mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	Improve stack overflow error message in GDScript and VisualScript
Stack overflow errors are generally the result of infinite recursion within a script.
This commit is contained in:
		
							parent
							
								
									68b86220c8
								
							
						
					
					
						commit
						cceeb671db
					
				
					 3 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
					@ -368,7 +368,7 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (_debug_call_stack_pos >= _debug_max_call_stack) {
 | 
							if (_debug_call_stack_pos >= _debug_max_call_stack) {
 | 
				
			||||||
			//stack overflow
 | 
								//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);
 | 
								EngineDebugger::get_script_debugger()->debug(this);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1582,7 +1582,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (!found) {
 | 
										if (!found) {
 | 
				
			||||||
						r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
 | 
											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;
 | 
											error = true;
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					@ -1594,7 +1594,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
 | 
				
			||||||
					// Check for stack overflow.
 | 
										// Check for stack overflow.
 | 
				
			||||||
					if (flow_stack_pos + 1 >= flow_max) {
 | 
										if (flow_stack_pos + 1 >= flow_max) {
 | 
				
			||||||
						r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
 | 
											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;
 | 
											error = true;
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -522,7 +522,7 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (_debug_call_stack_pos >= _debug_max_call_stack) {
 | 
							if (_debug_call_stack_pos >= _debug_max_call_stack) {
 | 
				
			||||||
			// Stack overflow.
 | 
								// 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);
 | 
								EngineDebugger::get_script_debugger()->debug(this);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -545,7 +545,7 @@ public:
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (_debug_call_stack_pos == 0) {
 | 
							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);
 | 
								EngineDebugger::get_script_debugger()->debug(this);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue