summaryrefslogtreecommitdiffstats
path: root/core/io/resource_loader.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-11-23 16:19:24 +0100
committerYuri Sizov <yuris@humnom.net>2023-11-23 16:24:43 +0100
commitbc1949d7978c428ae3579e240368e20022ee77cd (patch)
treeecee80e7e1211db4320b5f90001d845d8fd60bac /core/io/resource_loader.cpp
parentbb63963486a389d4417ba13249a40219f3774df0 (diff)
downloadredot-engine-bc1949d7978c428ae3579e240368e20022ee77cd.tar.gz
Correctly check scripts that must inherit `EditorPlugin`
Also updates some error messages related to this kind of check across the codebase.
Diffstat (limited to 'core/io/resource_loader.cpp')
-rw-r--r--core/io/resource_loader.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 529128b9a2..1fbb6ff2ed 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -1113,11 +1113,10 @@ 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_FAIL_COND_V_MSG(!valid_type, false, "Script does not inherit a CustomResourceLoader: " + script_path + ".");
+ ERR_FAIL_COND_V_MSG(!valid_type, false, vformat("Failed to add a custom resource loader, script '%s' does not inherit 'ResourceFormatLoader'.", script_path));
Object *obj = ClassDB::instantiate(ibt);
-
- ERR_FAIL_NULL_V_MSG(obj, false, "Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt) + ".");
+ ERR_FAIL_NULL_V_MSG(obj, false, vformat("Failed to add a custom resource loader, cannot instantiate '%s'.", ibt));
Ref<ResourceFormatLoader> crl = Object::cast_to<ResourceFormatLoader>(obj);
crl->set_script(s);