summaryrefslogtreecommitdiff
path: root/core/extension
diff options
context:
space:
mode:
authorJan Haller <bromeon@gmail.com>2022-06-19 10:14:41 +0200
committerJan Haller <bromeon@gmail.com>2022-06-19 10:14:41 +0200
commitd2dba74bae69564b7bb787c44bf42abe43b6e523 (patch)
tree6d1d3213a1c44b89a1b6e9e591995d5dadc8fa7f /core/extension
parent4366f8bcd455714a5cd29374726d83b674ff0430 (diff)
GDExtension: print error messages for different error paths during loading
Diffstat (limited to 'core/extension')
-rw-r--r--core/extension/native_extension.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp
index ac9d2ca8a6..ebdfa20725 100644
--- a/core/extension/native_extension.cpp
+++ b/core/extension/native_extension.cpp
@@ -281,6 +281,7 @@ void NativeExtension::_get_library_path(const GDNativeExtensionClassLibraryPtr p
Error NativeExtension::open_library(const String &p_path, const String &p_entry_symbol) {
Error err = OS::get_singleton()->open_dynamic_library(p_path, library, true, &library_path);
if (err != OK) {
+ ERR_PRINT("GDExtension dynamic library not found: " + p_path);
return err;
}
@@ -289,6 +290,7 @@ Error NativeExtension::open_library(const String &p_path, const String &p_entry_
err = OS::get_singleton()->get_dynamic_library_symbol_handle(library, p_entry_symbol, entry_funcptr, false);
if (err != OK) {
+ ERR_PRINT("GDExtension entry point '" + p_entry_symbol + "' not found in library " + p_path);
OS::get_singleton()->close_dynamic_library(library);
return err;
}
@@ -299,6 +301,7 @@ Error NativeExtension::open_library(const String &p_path, const String &p_entry_
level_initialized = -1;
return OK;
} else {
+ ERR_PRINT("GDExtension initialization function '" + p_entry_symbol + "' returned an error.");
return FAILED;
}
}
@@ -387,6 +390,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St
}
if (err != OK) {
+ ERR_PRINT("Error loading GDExtension config file: " + p_path);
return Ref<Resource>();
}
@@ -394,6 +398,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St
if (r_error) {
*r_error = ERR_INVALID_DATA;
}
+ ERR_PRINT("GDExtension config file must contain 'configuration.entry_symbol' key: " + p_path);
return Ref<Resource>();
}
@@ -426,6 +431,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St
if (r_error) {
*r_error = ERR_FILE_NOT_FOUND;
}
+ ERR_PRINT("No GDExtension library found for current architecture; in config file " + p_path);
return Ref<Resource>();
}
@@ -443,6 +449,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St
}
if (err != OK) {
+ // Errors already logged in open_library()
return Ref<Resource>();
}