Merge pull request #100899 from dalexeev/core-unify-display-of-error-type-prefixes

Core: Unify display of error type prefixes
This commit is contained in:
Thaddeus Crews
2025-06-09 17:08:41 -05:00
13 changed files with 102 additions and 152 deletions

View File

@@ -852,6 +852,7 @@ Error GDScript::reload(bool p_keep_state) {
err = compiler.compile(&parser, this, p_keep_state);
if (err) {
// TODO: Provide the script function as the first argument.
_err_print_error("GDScript::reload", path.is_empty() ? "built-in" : (const char *)path.utf8().get_data(), compiler.get_error_line(), ("Compile Error: " + compiler.get_error()).utf8().get_data(), false, ERR_HANDLER_SCRIPT);
if (can_run) {
if (EngineDebugger::is_active()) {
@@ -875,7 +876,8 @@ Error GDScript::reload(bool p_keep_state) {
for (const GDScriptWarning &warning : parser.get_warnings()) {
if (EngineDebugger::is_active()) {
Vector<ScriptLanguage::StackInfo> si;
EngineDebugger::get_script_debugger()->send_error("", get_script_path(), warning.start_line, warning.get_name(), warning.get_message(), false, ERR_HANDLER_WARNING, si);
// TODO: Provide the script function as the first argument.
EngineDebugger::get_script_debugger()->send_error("GDScript::reload", get_script_path(), warning.start_line, warning.get_name(), warning.get_message(), false, ERR_HANDLER_WARNING, si);
}
}
#endif

View File

@@ -453,30 +453,11 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
result->status = GDTEST_RUNTIME_ERROR;
String header = _error_handler_type_string(p_type);
// Only include the file, line, and function for script errors,
// otherwise the test outputs changes based on the platform/compiler.
String header;
bool include_source_info = false;
switch (p_type) {
case ERR_HANDLER_ERROR:
header = "ERROR";
break;
case ERR_HANDLER_WARNING:
header = "WARNING";
break;
case ERR_HANDLER_SCRIPT:
header = "SCRIPT ERROR";
include_source_info = true;
break;
case ERR_HANDLER_SHADER:
header = "SHADER ERROR";
break;
default:
header = "UNKNOWN ERROR";
break;
}
if (include_source_info) {
if (p_type == ERR_HANDLER_SCRIPT) {
header += vformat(" at %s:%d on %s()",
String::utf8(p_file).trim_prefix(self->base_dir).replace_char('\\', '/'),
p_line,