Skip to content

Commit dbc75f2

Browse files
committed
Merge pull request #106720 from Calinou/resourceloader-tweak-error-messages
Improve error messages in ResourceLoader
2 parents 15c3656 + 16d551a commit dbc75f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/io/resource_loader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,23 +339,23 @@ Ref<Resource> ResourceLoader::_load(const String &p_path, const String &p_origin
339339
}
340340
}
341341
#endif
342-
ERR_FAIL_COND_V_MSG(found, Ref<Resource>(),
343-
vformat("Failed loading resource: %s. Make sure resources have been imported by opening the project in the editor at least once.", p_path));
342+
343+
ERR_FAIL_COND_V_MSG(found, Ref<Resource>(), vformat("Failed loading resource: %s.", p_path));
344344

345345
#ifdef TOOLS_ENABLED
346346
Ref<FileAccess> file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES);
347347
if (!file_check->file_exists(p_path)) {
348348
if (r_error) {
349349
*r_error = ERR_FILE_NOT_FOUND;
350350
}
351-
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("Resource file not found: %s (expected type: %s)", p_path, p_type_hint));
351+
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("Resource file not found: %s (expected type: %s)", p_path, !p_type_hint.is_empty() ? p_type_hint : "unknown"));
352352
}
353353
#endif
354354

355355
if (r_error) {
356356
*r_error = ERR_FILE_UNRECOGNIZED;
357357
}
358-
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("No loader found for resource: %s (expected type: %s)", p_path, p_type_hint));
358+
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("No loader found for resource: %s (expected type: %s)", p_path, !p_type_hint.is_empty() ? p_type_hint : "unknown"));
359359
}
360360

361361
// This implementation must allow re-entrancy for a task that started awaiting in a deeper stack frame.

0 commit comments

Comments
 (0)