Skip to content

Commit 38f9769

Browse files
[Core] Improve error messages with vformat
1 parent 8004c75 commit 38f9769

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+292
-292
lines changed

core/config/project_settings.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -214,36 +214,36 @@ String ProjectSettings::localize_path(const String &p_path) const {
214214
}
215215

216216
void ProjectSettings::set_initial_value(const String &p_name, const Variant &p_value) {
217-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
217+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
218218

219219
// Duplicate so that if value is array or dictionary, changing the setting will not change the stored initial value.
220220
props[p_name].initial = p_value.duplicate();
221221
}
222222

223223
void ProjectSettings::set_restart_if_changed(const String &p_name, bool p_restart) {
224-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
224+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
225225
props[p_name].restart_if_changed = p_restart;
226226
}
227227

228228
void ProjectSettings::set_as_basic(const String &p_name, bool p_basic) {
229-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
229+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
230230
props[p_name].basic = p_basic;
231231
}
232232

233233
void ProjectSettings::set_as_internal(const String &p_name, bool p_internal) {
234-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
234+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
235235
props[p_name].internal = p_internal;
236236
}
237237

238238
void ProjectSettings::set_ignore_value_in_docs(const String &p_name, bool p_ignore) {
239-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
239+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
240240
#ifdef DEBUG_METHODS_ENABLED
241241
props[p_name].ignore_value_in_docs = p_ignore;
242242
#endif
243243
}
244244

245245
bool ProjectSettings::get_ignore_value_in_docs(const String &p_name) const {
246-
ERR_FAIL_COND_V_MSG(!props.has(p_name), false, "Request for nonexistent project setting: " + p_name + ".");
246+
ERR_FAIL_COND_V_MSG(!props.has(p_name), false, vformat("Request for nonexistent project setting: '%s'.", p_name));
247247
#ifdef DEBUG_METHODS_ENABLED
248248
return props[p_name].ignore_value_in_docs;
249249
#else
@@ -371,7 +371,7 @@ Variant ProjectSettings::get_setting_with_override(const StringName &p_name) con
371371
}
372372

373373
if (!props.has(name)) {
374-
WARN_PRINT("Property not found: " + String(name));
374+
WARN_PRINT(vformat("Property not found: '%s'.", String(name)));
375375
return Variant();
376376
}
377377
return props[name].variant;
@@ -565,7 +565,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
565565

566566
if (!p_main_pack.is_empty()) {
567567
bool ok = _load_resource_pack(p_main_pack);
568-
ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, "Cannot open resource pack '" + p_main_pack + "'.");
568+
ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, vformat("Cannot open resource pack '%s'.", p_main_pack));
569569

570570
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
571571
if (err == OK && !p_ignore_override) {
@@ -644,7 +644,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
644644
// or, if requested (`p_upwards`) in parent directories.
645645

646646
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
647-
ERR_FAIL_COND_V_MSG(d.is_null(), ERR_CANT_CREATE, "Cannot create DirAccess for path '" + p_path + "'.");
647+
ERR_FAIL_COND_V_MSG(d.is_null(), ERR_CANT_CREATE, vformat("Cannot create DirAccess for path '%s'.", p_path));
648648
d->change_dir(p_path);
649649

650650
String current_dir = d->get_current_dir();
@@ -748,7 +748,7 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) {
748748
f->get_buffer(d.ptrw(), vlen);
749749
Variant value;
750750
err = decode_variant(value, d.ptr(), d.size(), nullptr, true);
751-
ERR_CONTINUE_MSG(err != OK, "Error decoding property: " + key + ".");
751+
ERR_CONTINUE_MSG(err != OK, vformat("Error decoding property: '%s'.", key));
752752
set(key, value);
753753
}
754754

@@ -790,7 +790,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
790790
last_save_time = FileAccess::get_modified_time(get_resource_path().path_join("project.godot"));
791791
return OK;
792792
}
793-
ERR_FAIL_COND_V_MSG(err != OK, err, "Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted.");
793+
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Error parsing '%s' at line %d: %s File might be corrupted.", p_path, lines, error_text));
794794

795795
if (!assign.is_empty()) {
796796
if (section.is_empty() && assign == "config_version") {
@@ -816,15 +816,15 @@ Error ProjectSettings::_load_settings_text_or_binary(const String &p_text_path,
816816
return OK;
817817
} else if (err != ERR_FILE_NOT_FOUND) {
818818
// If the file exists but can't be loaded, we want to know it.
819-
ERR_PRINT("Couldn't load file '" + p_bin_path + "', error code " + itos(err) + ".");
819+
ERR_PRINT(vformat("Couldn't load file '%s', error code %d.", p_bin_path, err));
820820
}
821821

822822
// Fallback to text-based project.godot file if binary was not found.
823823
err = _load_settings_text(p_text_path);
824824
if (err == OK) {
825825
return OK;
826826
} else if (err != ERR_FILE_NOT_FOUND) {
827-
ERR_PRINT("Couldn't load file '" + p_text_path + "', error code " + itos(err) + ".");
827+
ERR_PRINT(vformat("Couldn't load file '%s', error code %d.", p_text_path, err));
828828
}
829829

830830
return err;
@@ -838,30 +838,30 @@ Error ProjectSettings::load_custom(const String &p_path) {
838838
}
839839

840840
int ProjectSettings::get_order(const String &p_name) const {
841-
ERR_FAIL_COND_V_MSG(!props.has(p_name), -1, "Request for nonexistent project setting: " + p_name + ".");
841+
ERR_FAIL_COND_V_MSG(!props.has(p_name), -1, vformat("Request for nonexistent project setting: '%s'.", p_name));
842842
return props[p_name].order;
843843
}
844844

845845
void ProjectSettings::set_order(const String &p_name, int p_order) {
846-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
846+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
847847
props[p_name].order = p_order;
848848
}
849849

850850
void ProjectSettings::set_builtin_order(const String &p_name) {
851-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
851+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
852852
if (props[p_name].order >= NO_BUILTIN_ORDER_BASE) {
853853
props[p_name].order = last_builtin_order++;
854854
}
855855
}
856856

857857
bool ProjectSettings::is_builtin_setting(const String &p_name) const {
858858
// Return true because a false negative is worse than a false positive.
859-
ERR_FAIL_COND_V_MSG(!props.has(p_name), true, "Request for nonexistent project setting: " + p_name + ".");
859+
ERR_FAIL_COND_V_MSG(!props.has(p_name), true, vformat("Request for nonexistent project setting: '%s'.", p_name));
860860
return props[p_name].order < NO_BUILTIN_ORDER_BASE;
861861
}
862862

863863
void ProjectSettings::clear(const String &p_name) {
864-
ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + ".");
864+
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
865865
props.erase(p_name);
866866
}
867867

@@ -876,7 +876,7 @@ Error ProjectSettings::save() {
876876
Error ProjectSettings::_save_settings_binary(const String &p_file, const RBMap<String, List<String>> &p_props, const CustomMap &p_custom, const String &p_custom_features) {
877877
Error err;
878878
Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
879-
ERR_FAIL_COND_V_MSG(err != OK, err, "Couldn't save project.binary at " + p_file + ".");
879+
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Couldn't save project.binary at '%s'.", p_file));
880880

881881
uint8_t hdr[4] = { 'E', 'C', 'F', 'G' };
882882
file->store_buffer(hdr, 4);
@@ -946,7 +946,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const RBMap<Str
946946
Error err;
947947
Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
948948

949-
ERR_FAIL_COND_V_MSG(err != OK, err, "Couldn't save project.godot - " + p_file + ".");
949+
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Couldn't save project.godot - %s.", p_file));
950950

951951
file->store_line("; Engine configuration file.");
952952
file->store_line("; It's best edited using the editor UI and not directly,");
@@ -1119,7 +1119,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
11191119
} else if (p_path.ends_with(".binary")) {
11201120
return _save_settings_binary(p_path, save_props, p_custom, save_features);
11211121
} else {
1122-
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unknown config file format: " + p_path);
1122+
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, vformat("Unknown config file format: '%s'.", p_path));
11231123
}
11241124
}
11251125

core/core_bind.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Ref<Resource> ResourceLoader::load(const String &p_path, const String &p_type_hi
7575
Error err = OK;
7676
Ref<Resource> ret = ::ResourceLoader::load(p_path, p_type_hint, ResourceFormatLoader::CacheMode(p_cache_mode), &err);
7777

78-
ERR_FAIL_COND_V_MSG(err != OK, ret, "Error loading resource: '" + p_path + "'.");
78+
ERR_FAIL_COND_V_MSG(err != OK, ret, vformat("Error loading resource: '%s'.", p_path));
7979
return ret;
8080
}
8181

@@ -1315,7 +1315,7 @@ void Thread::_start_func(void *ud) {
13151315
}
13161316

13171317
if (ce.error != Callable::CallError::CALL_OK) {
1318-
ERR_FAIL_MSG("Could not call function '" + func_name + "' to start thread " + t->get_id() + ": " + Variant::get_callable_error_text(t->target_callable, nullptr, 0, ce) + ".");
1318+
ERR_FAIL_MSG(vformat("Could not call function '%s' to start thread %d: %s.", func_name, t->get_id(), Variant::get_callable_error_text(t->target_callable, nullptr, 0, ce)));
13191319
}
13201320
}
13211321

@@ -1814,8 +1814,8 @@ Object *Engine::get_singleton_object(const StringName &p_name) const {
18141814
}
18151815

18161816
void Engine::register_singleton(const StringName &p_name, Object *p_object) {
1817-
ERR_FAIL_COND_MSG(has_singleton(p_name), "Singleton already registered: " + String(p_name));
1818-
ERR_FAIL_COND_MSG(!String(p_name).is_valid_ascii_identifier(), "Singleton name is not a valid identifier: " + p_name);
1817+
ERR_FAIL_COND_MSG(has_singleton(p_name), vformat("Singleton already registered: '%s'.", String(p_name)));
1818+
ERR_FAIL_COND_MSG(!String(p_name).is_valid_ascii_identifier(), vformat("Singleton name is not a valid identifier: '%s'.", p_name));
18191819
::Engine::Singleton s;
18201820
s.class_name = p_name;
18211821
s.name = p_name;
@@ -1825,8 +1825,8 @@ void Engine::register_singleton(const StringName &p_name, Object *p_object) {
18251825
}
18261826

18271827
void Engine::unregister_singleton(const StringName &p_name) {
1828-
ERR_FAIL_COND_MSG(!has_singleton(p_name), "Attempt to remove unregistered singleton: " + String(p_name));
1829-
ERR_FAIL_COND_MSG(!::Engine::get_singleton()->is_singleton_user_created(p_name), "Attempt to remove non-user created singleton: " + String(p_name));
1828+
ERR_FAIL_COND_MSG(!has_singleton(p_name), vformat("Attempt to remove unregistered singleton: '%s'.", String(p_name)));
1829+
ERR_FAIL_COND_MSG(!::Engine::get_singleton()->is_singleton_user_created(p_name), vformat("Attempt to remove non-user created singleton: '%s'.", String(p_name)));
18301830
::Engine::get_singleton()->remove_singleton(p_name);
18311831
}
18321832

@@ -1970,14 +1970,14 @@ bool EngineDebugger::is_active() {
19701970
void EngineDebugger::register_profiler(const StringName &p_name, Ref<EngineProfiler> p_profiler) {
19711971
ERR_FAIL_COND(p_profiler.is_null());
19721972
ERR_FAIL_COND_MSG(p_profiler->is_bound(), "Profiler already registered.");
1973-
ERR_FAIL_COND_MSG(profilers.has(p_name) || has_profiler(p_name), "Profiler name already in use: " + p_name);
1973+
ERR_FAIL_COND_MSG(profilers.has(p_name) || has_profiler(p_name), vformat("Profiler name already in use: '%s'.", p_name));
19741974
Error err = p_profiler->bind(p_name);
1975-
ERR_FAIL_COND_MSG(err != OK, "Profiler failed to register with error: " + itos(err));
1975+
ERR_FAIL_COND_MSG(err != OK, vformat("Profiler failed to register with error: %d.", err));
19761976
profilers.insert(p_name, p_profiler);
19771977
}
19781978

19791979
void EngineDebugger::unregister_profiler(const StringName &p_name) {
1980-
ERR_FAIL_COND_MSG(!profilers.has(p_name), "Profiler not registered: " + p_name);
1980+
ERR_FAIL_COND_MSG(!profilers.has(p_name), vformat("Profiler not registered: '%s'.", p_name));
19811981
profilers[p_name]->unbind();
19821982
profilers.erase(p_name);
19831983
}
@@ -2001,15 +2001,15 @@ void EngineDebugger::profiler_enable(const StringName &p_name, bool p_enabled, c
20012001
}
20022002

20032003
void EngineDebugger::register_message_capture(const StringName &p_name, const Callable &p_callable) {
2004-
ERR_FAIL_COND_MSG(captures.has(p_name) || has_capture(p_name), "Capture already registered: " + p_name);
2004+
ERR_FAIL_COND_MSG(captures.has(p_name) || has_capture(p_name), vformat("Capture already registered: '%s'.", p_name));
20052005
captures.insert(p_name, p_callable);
20062006
Callable &c = captures[p_name];
20072007
::EngineDebugger::Capture capture(&c, &EngineDebugger::call_capture);
20082008
::EngineDebugger::register_message_capture(p_name, capture);
20092009
}
20102010

20112011
void EngineDebugger::unregister_message_capture(const StringName &p_name) {
2012-
ERR_FAIL_COND_MSG(!captures.has(p_name), "Capture not registered: " + p_name);
2012+
ERR_FAIL_COND_MSG(!captures.has(p_name), vformat("Capture not registered: '%s'.", p_name));
20132013
::EngineDebugger::unregister_message_capture(p_name);
20142014
captures.erase(p_name);
20152015
}
@@ -2043,8 +2043,8 @@ Error EngineDebugger::call_capture(void *p_user, const String &p_cmd, const Arra
20432043
Variant retval;
20442044
Callable::CallError err;
20452045
capture.callp(args, 2, retval, err);
2046-
ERR_FAIL_COND_V_MSG(err.error != Callable::CallError::CALL_OK, FAILED, "Error calling 'capture' to callable: " + Variant::get_callable_error_text(capture, args, 2, err));
2047-
ERR_FAIL_COND_V_MSG(retval.get_type() != Variant::BOOL, FAILED, "Error calling 'capture' to callable: " + String(capture) + ". Return type is not bool.");
2046+
ERR_FAIL_COND_V_MSG(err.error != Callable::CallError::CALL_OK, FAILED, vformat("Error calling 'capture' to callable: %s.", Variant::get_callable_error_text(capture, args, 2, err)));
2047+
ERR_FAIL_COND_V_MSG(retval.get_type() != Variant::BOOL, FAILED, vformat("Error calling 'capture' to callable: '%s'. Return type is not bool.", String(capture)));
20482048
r_captured = retval;
20492049
return OK;
20502050
}

core/crypto/crypto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Error ResourceFormatSaverCrypto::save(const Ref<Resource> &p_resource, const Str
240240
} else {
241241
ERR_FAIL_V(ERR_INVALID_PARAMETER);
242242
}
243-
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save Crypto resource to file '" + p_path + "'.");
243+
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Cannot save Crypto resource to file '%s'.", p_path));
244244
return OK;
245245
}
246246

core/crypto/crypto_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ int CryptoCore::RandomGenerator::_entropy_poll(void *p_data, unsigned char *r_bu
7070
Error CryptoCore::RandomGenerator::init() {
7171
int ret = mbedtls_ctr_drbg_seed((mbedtls_ctr_drbg_context *)ctx, mbedtls_entropy_func, (mbedtls_entropy_context *)entropy, nullptr, 0);
7272
if (ret) {
73-
ERR_FAIL_COND_V_MSG(ret, FAILED, " failed\n ! mbedtls_ctr_drbg_seed returned an error" + itos(ret));
73+
ERR_FAIL_COND_V_MSG(ret, FAILED, vformat(" failed\n ! mbedtls_ctr_drbg_seed returned an error %d.", ret));
7474
}
7575
return OK;
7676
}
7777

7878
Error CryptoCore::RandomGenerator::get_random_bytes(uint8_t *r_buffer, size_t p_bytes) {
7979
ERR_FAIL_NULL_V(ctx, ERR_UNCONFIGURED);
8080
int ret = mbedtls_ctr_drbg_random((mbedtls_ctr_drbg_context *)ctx, r_buffer, p_bytes);
81-
ERR_FAIL_COND_V_MSG(ret, FAILED, " failed\n ! mbedtls_ctr_drbg_seed returned an error" + itos(ret));
81+
ERR_FAIL_COND_V_MSG(ret, FAILED, vformat(" failed\n ! mbedtls_ctr_drbg_seed returned an error %d.", ret));
8282
return OK;
8383
}
8484

core/debugger/engine_debugger.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ HashMap<String, EngineDebugger::CreatePeerFunc> EngineDebugger::protocols;
4646
void (*EngineDebugger::allow_focus_steal_fn)();
4747

4848
void EngineDebugger::register_profiler(const StringName &p_name, const Profiler &p_func) {
49-
ERR_FAIL_COND_MSG(profilers.has(p_name), "Profiler already registered: " + p_name);
49+
ERR_FAIL_COND_MSG(profilers.has(p_name), vformat("Profiler already registered: '%s'.", p_name));
5050
profilers.insert(p_name, p_func);
5151
}
5252

5353
void EngineDebugger::unregister_profiler(const StringName &p_name) {
54-
ERR_FAIL_COND_MSG(!profilers.has(p_name), "Profiler not registered: " + p_name);
54+
ERR_FAIL_COND_MSG(!profilers.has(p_name), vformat("Profiler not registered: '%s'.", p_name));
5555
Profiler &p = profilers[p_name];
5656
if (p.active && p.toggle) {
5757
p.toggle(p.data, false, Array());
@@ -61,22 +61,22 @@ void EngineDebugger::unregister_profiler(const StringName &p_name) {
6161
}
6262

6363
void EngineDebugger::register_message_capture(const StringName &p_name, Capture p_func) {
64-
ERR_FAIL_COND_MSG(captures.has(p_name), "Capture already registered: " + p_name);
64+
ERR_FAIL_COND_MSG(captures.has(p_name), vformat("Capture already registered: '%s'.", p_name));
6565
captures.insert(p_name, p_func);
6666
}
6767

6868
void EngineDebugger::unregister_message_capture(const StringName &p_name) {
69-
ERR_FAIL_COND_MSG(!captures.has(p_name), "Capture not registered: " + p_name);
69+
ERR_FAIL_COND_MSG(!captures.has(p_name), vformat("Capture not registered: '%s'.", p_name));
7070
captures.erase(p_name);
7171
}
7272

7373
void EngineDebugger::register_uri_handler(const String &p_protocol, CreatePeerFunc p_func) {
74-
ERR_FAIL_COND_MSG(protocols.has(p_protocol), "Protocol handler already registered: " + p_protocol);
74+
ERR_FAIL_COND_MSG(protocols.has(p_protocol), vformat("Protocol handler already registered: '%s'.", p_protocol));
7575
protocols.insert(p_protocol, p_func);
7676
}
7777

7878
void EngineDebugger::profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts) {
79-
ERR_FAIL_COND_MSG(!profilers.has(p_name), "Can't change profiler state, no profiler: " + p_name);
79+
ERR_FAIL_COND_MSG(!profilers.has(p_name), vformat("Can't change profiler state, no profiler: '%s'.", p_name));
8080
Profiler &p = profilers[p_name];
8181
if (p.toggle) {
8282
p.toggle(p.data, p_enabled, p_opts);
@@ -85,7 +85,7 @@ void EngineDebugger::profiler_enable(const StringName &p_name, bool p_enabled, c
8585
}
8686

8787
void EngineDebugger::profiler_add_frame_data(const StringName &p_name, const Array &p_data) {
88-
ERR_FAIL_COND_MSG(!profilers.has(p_name), "Can't add frame data, no profiler: " + p_name);
88+
ERR_FAIL_COND_MSG(!profilers.has(p_name), vformat("Can't add frame data, no profiler: '%s'.", p_name));
8989
Profiler &p = profilers[p_name];
9090
if (p.add) {
9191
p.add(p.data, p_data);
@@ -106,7 +106,7 @@ bool EngineDebugger::has_capture(const StringName &p_name) {
106106

107107
Error EngineDebugger::capture_parse(const StringName &p_name, const String &p_msg, const Array &p_args, bool &r_captured) {
108108
r_captured = false;
109-
ERR_FAIL_COND_V_MSG(!captures.has(p_name), ERR_UNCONFIGURED, "Capture not registered: " + p_name);
109+
ERR_FAIL_COND_V_MSG(!captures.has(p_name), ERR_UNCONFIGURED, vformat("Capture not registered: '%s'.", p_name));
110110
const Capture &cap = captures[p_name];
111111
return cap.capture(cap.data, p_msg, p_args, r_captured);
112112
}
@@ -164,7 +164,7 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, co
164164
for (int i = 0; i < p_breakpoints.size(); i++) {
165165
const String &bp = p_breakpoints[i];
166166
int sp = bp.rfind(":");
167-
ERR_CONTINUE_MSG(sp == -1, "Invalid breakpoint: '" + bp + "', expected file:line format.");
167+
ERR_CONTINUE_MSG(sp == -1, vformat("Invalid breakpoint: '%s', expected file:line format.", bp));
168168

169169
singleton_script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
170170
}

core/debugger/remote_debugger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class RemoteDebugger::PerformanceProfiler : public EngineProfiler {
7979
for (int i = 0; i < custom_monitor_names.size(); i++) {
8080
Variant monitor_value = performance->call("get_custom_monitor", custom_monitor_names[i]);
8181
if (!monitor_value.is_num()) {
82-
ERR_PRINT("Value of custom monitor '" + String(custom_monitor_names[i]) + "' is not a number");
82+
ERR_PRINT(vformat("Value of custom monitor '%s' is not a number.", String(custom_monitor_names[i])));
8383
arr[i + max] = Variant();
8484
} else {
8585
arr[i + max] = monitor_value;
@@ -569,7 +569,7 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
569569
bool captured = false;
570570
ERR_CONTINUE(_try_capture(command, data, captured) != OK);
571571
if (!captured) {
572-
WARN_PRINT("Unknown message received from debugger: " + command);
572+
WARN_PRINT(vformat("Unknown message received from debugger: %s.", command));
573573
}
574574
}
575575
} else {

0 commit comments

Comments
 (0)