summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-26 11:11:08 +0200
committerGitHub <noreply@github.com>2022-04-26 11:11:08 +0200
commitcb5f3a39b9be770537744094e930fcac42f8bbc3 (patch)
treeff1ec9fa6415f3af176f871f3b43cb548245e899
parent06c33cca18d81bc0976c512a0f6b608780fad958 (diff)
parentb3922a42e9f718c1a1ecd753c461657f9b158225 (diff)
Merge pull request #60418 from ShimmyShaman/master
-rw-r--r--modules/gdscript/gdscript.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 59254fc3ad..55c7ace938 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -1032,7 +1032,13 @@ Error GDScript::load_source_code(const String &p_path) {
Error err;
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ, &err);
if (err) {
- ERR_FAIL_COND_V(err, err);
+ const char *err_name;
+ if (err < 0 || err >= ERR_MAX) {
+ err_name = "(invalid error code)";
+ } else {
+ err_name = error_names[err];
+ }
+ ERR_FAIL_COND_V_MSG(err, err, "Attempt to open script '" + p_path + "' resulted in error '" + err_name + "'.");
}
uint64_t len = f->get_length();