MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / error_handler

Method error_handler

modules/gdscript/tests/gdscript_test_runner.cpp:457–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void GDScriptTest::error_handler(void *p_this, const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_explanation, bool p_editor_notify, ErrorHandlerType p_type) {
458 ErrorHandlerData *data = (ErrorHandlerData *)p_this;
459 GDScriptTest *self = data->self;
460 TestResult *result = data->result;
461
462 result->status = GDTEST_RUNTIME_ERROR;
463
464 String header = _error_handler_type_string(p_type);
465
466 // Only include the file, line, and function for script errors,
467 // otherwise the test outputs changes based on the platform/compiler.
468 if (p_type == ERR_HANDLER_SCRIPT) {
469 header += vformat(" at %s:%d on %s()",
470 String::utf8(p_file).trim_prefix(self->base_dir).replace_char('\\', '/'),
471 p_line,
472 String::utf8(p_function));
473 }
474
475 StringBuilder error_string;
476 error_string.append(vformat(">> %s: %s\n", header, String::utf8(p_error)));
477 if (strlen(p_explanation) > 0) {
478 error_string.append(vformat(">> %s\n", String::utf8(p_explanation)));
479 }
480
481 result->output += error_string.as_string();
482}
483
484bool GDScriptTest::check_output(const String &p_output) const {
485 Error err = OK;

Callers

nothing calls this directly

Calls 7

vformatFunction · 0.85
strlenFunction · 0.85
replace_charMethod · 0.80
trim_prefixMethod · 0.80
appendMethod · 0.45
as_stringMethod · 0.45

Tested by

no test coverage detected