Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", "modules/gdnative", "modules/gdscript" directories.

This commit is contained in:
Robin Hübner 2019-08-09 06:49:33 +02:00
parent 22b42c3315
commit 6ab118c464
24 changed files with 112 additions and 306 deletions

View file

@ -35,16 +35,14 @@
#include "pluginscript_script.h"
#ifdef DEBUG_ENABLED
#define __ASSERT_SCRIPT_REASON "Cannot retrieve pluginscript class for this script, is you code correct ?"
#define ASSERT_SCRIPT_VALID() \
{ \
ERR_EXPLAIN(__ASSERT_SCRIPT_REASON); \
ERR_FAIL_COND(!can_instance()); \
#define __ASSERT_SCRIPT_REASON "Cannot retrieve PluginScript class for this script, is your code correct?"
#define ASSERT_SCRIPT_VALID() \
{ \
ERR_FAIL_COND_MSG(!can_instance(), __ASSERT_SCRIPT_REASON); \
}
#define ASSERT_SCRIPT_VALID_V(ret) \
{ \
ERR_EXPLAIN(__ASSERT_SCRIPT_REASON); \
ERR_FAIL_COND_V(!can_instance(), ret); \
#define ASSERT_SCRIPT_VALID_V(ret) \
{ \
ERR_FAIL_COND_V_MSG(!can_instance(), ret, __ASSERT_SCRIPT_REASON); \
}
#else
#define ASSERT_SCRIPT_VALID()
@ -197,8 +195,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
// if (ScriptDebugger::get_singleton()) {
// _language->debug_break_parse(get_path(), 0, msg);
// }
ERR_EXPLAIN(msg);
ERR_FAIL_V(NULL);
ERR_FAIL_V_MSG(NULL, msg);
}
}
@ -272,8 +269,7 @@ Error PluginScript::reload(bool p_keep_state) {
_ref_base_parent = res;
} else {
String name = *(StringName *)&manifest.name;
ERR_EXPLAIN(_path + ": Script '" + name + "' has an invalid parent '" + *base_name + "'.");
ERR_FAIL_V(ERR_PARSE_ERROR);
ERR_FAIL_V_MSG(ERR_PARSE_ERROR, _path + ": Script '" + name + "' has an invalid parent '" + *base_name + "'.");
}
}
}
@ -420,8 +416,7 @@ Error PluginScript::load_source_code(const String &p_path) {
String s;
if (s.parse_utf8((const char *)w.ptr())) {
ERR_EXPLAIN("Script '" + p_path + "' contains invalid unicode (utf-8), so it was not loaded. Please ensure that scripts are saved in valid utf-8 unicode.");
ERR_FAIL_V(ERR_INVALID_DATA);
ERR_FAIL_V_MSG(ERR_INVALID_DATA, "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded. Please ensure that scripts are saved in valid UTF-8 unicode.");
}
_source = s;