mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?), core/os/memory.cpp, drivers/png/png_driver_common.cpp, drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
This commit is contained in:
committed by
Rémi Verschelde
parent
40640a01dc
commit
71d71d55b5
@@ -275,12 +275,9 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c
|
||||
return res;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
ERR_EXPLAIN("Failed loading resource: " + p_path);
|
||||
} else {
|
||||
ERR_EXPLAIN("No loader found for resource: " + p_path);
|
||||
}
|
||||
ERR_FAIL_V(RES());
|
||||
ERR_FAIL_COND_V_MSG(found, RES(), "Failed loading resource: " + p_path + ".");
|
||||
|
||||
ERR_FAIL_V_MSG(RES(), "No loader found for resource: " + p_path + ".");
|
||||
}
|
||||
|
||||
bool ResourceLoader::_add_to_loading_map(const String &p_path) {
|
||||
@@ -355,10 +352,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
|
||||
|
||||
{
|
||||
bool success = _add_to_loading_map(local_path);
|
||||
if (!success) {
|
||||
ERR_EXPLAIN("Resource: '" + local_path + "' is already being loaded. Cyclic reference?");
|
||||
ERR_FAIL_V(RES());
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!success, RES(), "Resource: '" + local_path + "' is already being loaded. Cyclic reference?");
|
||||
}
|
||||
|
||||
//lock first if possible
|
||||
@@ -395,8 +389,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
|
||||
if (!p_no_cache) {
|
||||
_remove_from_loading_map(local_path);
|
||||
}
|
||||
ERR_EXPLAIN("Remapping '" + local_path + "'failed.");
|
||||
ERR_FAIL_V(RES());
|
||||
ERR_FAIL_V_MSG(RES(), "Remapping '" + local_path + "' failed.");
|
||||
}
|
||||
|
||||
print_verbose("Loading resource: " + path);
|
||||
@@ -479,10 +472,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
|
||||
if (!p_no_cache) {
|
||||
|
||||
bool success = _add_to_loading_map(local_path);
|
||||
if (!success) {
|
||||
ERR_EXPLAIN("Resource: '" + local_path + "' is already being loaded. Cyclic reference?");
|
||||
ERR_FAIL_V(RES());
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!success, RES(), "Resource: '" + local_path + "' is already being loaded. Cyclic reference?");
|
||||
|
||||
if (ResourceCache::has(local_path)) {
|
||||
|
||||
@@ -503,8 +493,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
|
||||
if (!p_no_cache) {
|
||||
_remove_from_loading_map(local_path);
|
||||
}
|
||||
ERR_EXPLAIN("Remapping '" + local_path + "'failed.");
|
||||
ERR_FAIL_V(RES());
|
||||
ERR_FAIL_V_MSG(RES(), "Remapping '" + local_path + "' failed.");
|
||||
}
|
||||
|
||||
print_verbose("Loading resource: " + path);
|
||||
@@ -534,12 +523,9 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
|
||||
_remove_from_loading_map(local_path);
|
||||
}
|
||||
|
||||
if (found) {
|
||||
ERR_EXPLAIN("Failed loading resource: " + path);
|
||||
} else {
|
||||
ERR_EXPLAIN("No loader found for resource: " + path);
|
||||
}
|
||||
ERR_FAIL_V(Ref<ResourceInteractiveLoader>());
|
||||
ERR_FAIL_COND_V_MSG(found, Ref<ResourceInteractiveLoader>(), "Failed loading resource: " + path + ".");
|
||||
|
||||
ERR_FAIL_V_MSG(Ref<ResourceInteractiveLoader>(), "No loader found for resource: " + path + ".");
|
||||
}
|
||||
|
||||
void ResourceLoader::add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front) {
|
||||
@@ -801,7 +787,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
|
||||
if (err == ERR_FILE_EOF) {
|
||||
break;
|
||||
} else if (err != OK) {
|
||||
ERR_PRINTS("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text);
|
||||
ERR_PRINTS("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + ".");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -932,13 +918,11 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
|
||||
Ref<Script> s = res;
|
||||
StringName ibt = s->get_instance_base_type();
|
||||
bool valid_type = ClassDB::is_parent_class(ibt, "ResourceFormatLoader");
|
||||
ERR_EXPLAIN("Script does not inherit a CustomResourceLoader: " + script_path);
|
||||
ERR_FAIL_COND_V(!valid_type, false);
|
||||
ERR_FAIL_COND_V_MSG(!valid_type, false, "Script does not inherit a CustomResourceLoader: " + script_path + ".");
|
||||
|
||||
Object *obj = ClassDB::instance(ibt);
|
||||
|
||||
ERR_EXPLAIN("Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt));
|
||||
ERR_FAIL_COND_V(obj == NULL, false);
|
||||
ERR_FAIL_COND_V_MSG(obj == NULL, false, "Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt) + ".");
|
||||
|
||||
ResourceFormatLoader *crl = Object::cast_to<ResourceFormatLoader>(obj);
|
||||
crl->set_script(s.get_ref_ptr());
|
||||
|
||||
Reference in New Issue
Block a user