Added some obvious errors explanations
This commit is contained in:
parent
e9f49a6d5a
commit
17732fe698
125 changed files with 435 additions and 458 deletions
|
|
@ -282,7 +282,7 @@ void CSGShape::_update_shape() {
|
|||
root_mesh.unref(); //byebye root mesh
|
||||
|
||||
CSGBrush *n = _get_brush();
|
||||
ERR_FAIL_COND(!n);
|
||||
ERR_FAIL_COND_MSG(!n, "Cannot get CSGBrush.");
|
||||
|
||||
OAHashMap<Vector3, Vector3> vec_map;
|
||||
|
||||
|
|
@ -2407,7 +2407,7 @@ NodePath CSGPolygon::get_path_node() const {
|
|||
}
|
||||
|
||||
void CSGPolygon::set_path_interval(float p_interval) {
|
||||
ERR_FAIL_COND(p_interval < 0.001);
|
||||
ERR_FAIL_COND_MSG(p_interval < 0.001, "Path interval cannot be smaller than 0.001.");
|
||||
path_interval = p_interval;
|
||||
_make_dirty();
|
||||
update_gizmo();
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
|
|||
if (r_error)
|
||||
*r_error = ERR_FILE_CORRUPT;
|
||||
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open DDS texture file: " + p_path + ".");
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open DDS texture file '" + p_path + "'.");
|
||||
|
||||
uint32_t magic = f->get_32();
|
||||
uint32_t hsize = f->get_32();
|
||||
|
|
@ -127,7 +127,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
|
|||
|
||||
if (magic != DDS_MAGIC || hsize != 124 || !(flags & DDSD_PIXELFORMAT) || !(flags & DDSD_CAPS)) {
|
||||
|
||||
ERR_FAIL_V_MSG(RES(), "Invalid or unsupported DDS texture file: " + p_path + ".");
|
||||
ERR_FAIL_V_MSG(RES(), "Invalid or unsupported DDS texture file '" + p_path + "'.");
|
||||
}
|
||||
|
||||
/* uint32_t format_size = */ f->get_32();
|
||||
|
|
@ -216,7 +216,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
|
|||
} else {
|
||||
|
||||
printf("unrecognized fourcc %x format_flags: %x - rgbbits %i - red_mask %x green mask %x blue mask %x alpha mask %x\n", format_fourcc, format_flags, format_rgb_bits, format_red_mask, format_green_mask, format_blue_mask, format_alpha_mask);
|
||||
ERR_FAIL_V_MSG(RES(), "Unrecognized or unsupported color layout in DDS: " + p_path + ".");
|
||||
ERR_FAIL_V_MSG(RES(), "Unrecognized or unsupported color layout in DDS '" + p_path + "'.");
|
||||
}
|
||||
|
||||
if (!(flags & DDSD_MIPMAPCOUNT))
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
|
|||
if (target_peer != 0) {
|
||||
|
||||
E = peer_map.find(ABS(target_peer));
|
||||
ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, "Invalid target peer: " + itos(target_peer) + ".");
|
||||
ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, "Invalid target peer '" + itos(target_peer) + "'.");
|
||||
}
|
||||
|
||||
ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags);
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path,
|
|||
if (r_error)
|
||||
*r_error = ERR_FILE_CORRUPT;
|
||||
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open PKM texture file: " + p_path + ".");
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Unable to open PKM texture file '" + p_path + "'.");
|
||||
|
||||
// big endian
|
||||
f->set_endian_swap(true);
|
||||
|
||||
ETC1Header h;
|
||||
f->get_buffer((uint8_t *)&h.tag, sizeof(h.tag));
|
||||
ERR_FAIL_COND_V_MSG(strncmp(h.tag, "PKM 10", sizeof(h.tag)), RES(), "Invalid or unsupported PKM texture file: " + p_path + ".");
|
||||
ERR_FAIL_COND_V_MSG(strncmp(h.tag, "PKM 10", sizeof(h.tag)), RES(), "Invalid or unsupported PKM texture file '" + p_path + "'.");
|
||||
|
||||
h.format = f->get_16();
|
||||
h.texWidth = f->get_16();
|
||||
|
|
|
|||
|
|
@ -401,9 +401,7 @@ Error PluginScript::load_source_code(const String &p_path) {
|
|||
PoolVector<uint8_t> sourcef;
|
||||
Error err;
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||
if (err) {
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Cannot open file '" + p_path + "'.");
|
||||
|
||||
int len = f->get_len();
|
||||
sourcef.resize(len + 1);
|
||||
|
|
|
|||
|
|
@ -2177,11 +2177,11 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori
|
|||
script->set_script_path(p_original_path); // script needs this.
|
||||
script->set_path(p_original_path);
|
||||
Error err = script->load_byte_code(p_path);
|
||||
ERR_FAIL_COND_V(err != OK, RES());
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Cannot load byte code from file '" + p_path + "'.");
|
||||
|
||||
} else {
|
||||
Error err = script->load_source_code(p_path);
|
||||
ERR_FAIL_COND_V(err != OK, RES());
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Cannot load source code from file '" + p_path + "'.");
|
||||
|
||||
script->set_script_path(p_original_path); // script needs this.
|
||||
script->set_path(p_original_path);
|
||||
|
|
@ -2217,7 +2217,7 @@ String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) con
|
|||
void ResourceFormatLoaderGDScript::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {
|
||||
|
||||
FileAccessRef file = FileAccess::open(p_path, FileAccess::READ);
|
||||
ERR_FAIL_COND(!file);
|
||||
ERR_FAIL_COND_MSG(!file, "Cannot open file '" + p_path + "'.");
|
||||
|
||||
String source = file->get_as_utf8_string();
|
||||
if (source.empty()) {
|
||||
|
|
@ -2244,10 +2244,7 @@ Error ResourceFormatSaverGDScript::save(const String &p_path, const RES &p_resou
|
|||
Error err;
|
||||
FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
|
||||
|
||||
if (err) {
|
||||
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Cannot save GDScript file '" + p_path + "'.");
|
||||
|
||||
file->store_string(source);
|
||||
if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) {
|
||||
|
|
|
|||
|
|
@ -1425,7 +1425,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code)
|
|||
int len;
|
||||
// Objects cannot be constant, never encode objects
|
||||
Error err = encode_variant(E->get(), NULL, len, false);
|
||||
ERR_FAIL_COND_V(err != OK, Vector<uint8_t>());
|
||||
ERR_FAIL_COND_V_MSG(err != OK, Vector<uint8_t>(), "Error when trying to encode Variant.");
|
||||
int pos = buf.size();
|
||||
buf.resize(pos + len);
|
||||
encode_variant(E->get(), &buf.write[pos], len, false);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ Error CryptoKeyMbedTLS::load(String p_path) {
|
|||
|
||||
PoolByteArray out;
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
|
||||
ERR_FAIL_COND_V(!f, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot open CryptoKeyMbedTLS file '" + p_path + "'.");
|
||||
|
||||
int flen = f->get_len();
|
||||
out.resize(flen + 1);
|
||||
|
|
@ -69,14 +69,14 @@ Error CryptoKeyMbedTLS::load(String p_path) {
|
|||
int ret = mbedtls_pk_parse_key(&pkey, out.read().ptr(), out.size(), NULL, 0);
|
||||
// We MUST zeroize the memory for safety!
|
||||
mbedtls_platform_zeroize(out.write().ptr(), out.size());
|
||||
ERR_FAIL_COND_V_MSG(ret, FAILED, "Error parsing private key: " + itos(ret));
|
||||
ERR_FAIL_COND_V_MSG(ret, FAILED, "Error parsing private key '" + itos(ret) + "'.");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error CryptoKeyMbedTLS::save(String p_path) {
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE);
|
||||
ERR_FAIL_COND_V(!f, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot save CryptoKeyMbedTLS file '" + p_path + "'.");
|
||||
|
||||
unsigned char w[16000];
|
||||
memset(w, 0, sizeof(w));
|
||||
|
|
@ -85,7 +85,7 @@ Error CryptoKeyMbedTLS::save(String p_path) {
|
|||
if (ret != 0) {
|
||||
memdelete(f);
|
||||
memset(w, 0, sizeof(w)); // Zeroize anything we might have written.
|
||||
ERR_FAIL_V_MSG(FAILED, "Error writing key: " + itos(ret));
|
||||
ERR_FAIL_V_MSG(FAILED, "Error writing key '" + itos(ret) + "'.");
|
||||
}
|
||||
|
||||
size_t len = strlen((char *)w);
|
||||
|
|
@ -104,7 +104,7 @@ Error X509CertificateMbedTLS::load(String p_path) {
|
|||
|
||||
PoolByteArray out;
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
|
||||
ERR_FAIL_COND_V(!f, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot open X509CertificateMbedTLS file '" + p_path + "'.");
|
||||
|
||||
int flen = f->get_len();
|
||||
out.resize(flen + 1);
|
||||
|
|
@ -131,7 +131,7 @@ Error X509CertificateMbedTLS::load_from_memory(const uint8_t *p_buffer, int p_le
|
|||
|
||||
Error X509CertificateMbedTLS::save(String p_path) {
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE);
|
||||
ERR_FAIL_COND_V(!f, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot save X509CertificateMbedTLS file '" + p_path + "'.");
|
||||
|
||||
mbedtls_x509_crt *crt = &cert;
|
||||
while (crt) {
|
||||
|
|
@ -140,7 +140,7 @@ Error X509CertificateMbedTLS::save(String p_path) {
|
|||
int ret = mbedtls_pem_write_buffer(PEM_BEGIN_CRT, PEM_END_CRT, cert.raw.p, cert.raw.len, w, sizeof(w), &wrote);
|
||||
if (ret != 0 || wrote == 0) {
|
||||
memdelete(f);
|
||||
ERR_FAIL_V_MSG(FAILED, "Error writing certificate: " + itos(ret));
|
||||
ERR_FAIL_V_MSG(FAILED, "Error writing certificate '" + itos(ret) + "'.");
|
||||
}
|
||||
|
||||
f->store_buffer(w, wrote - 1); // don't write the string terminator
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
}
|
||||
|
||||
FileAccessRef f = FileAccess::open(p_output_file, FileAccess::WRITE);
|
||||
ERR_FAIL_COND(!f);
|
||||
ERR_FAIL_COND_MSG(!f, "Cannot open file '" + p_output_file + "'.");
|
||||
f->store_string(JSON::print(classes_dict, /*indent: */ "\t"));
|
||||
f->close();
|
||||
|
||||
|
|
|
|||
|
|
@ -1195,7 +1195,7 @@ void CSharpLanguage::release_script_gchandle(MonoObject *p_expected_obj, Ref<Mon
|
|||
|
||||
CSharpLanguage::CSharpLanguage() {
|
||||
|
||||
ERR_FAIL_COND(singleton);
|
||||
ERR_FAIL_COND_MSG(singleton, "C# singleton already exist.");
|
||||
singleton = this;
|
||||
|
||||
finalizing = false;
|
||||
|
|
@ -3242,7 +3242,7 @@ RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p
|
|||
|
||||
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
|
||||
Error err = script->load_source_code(p_path);
|
||||
ERR_FAIL_COND_V(err != OK, RES());
|
||||
ERR_FAIL_COND_V_MSG(err != OK, RES(), "Cannot load C# script file '" + p_path + "'.");
|
||||
#endif
|
||||
|
||||
script->set_path(p_original_path);
|
||||
|
|
@ -3325,7 +3325,7 @@ Error ResourceFormatSaverCSharpScript::save(const String &p_path, const RES &p_r
|
|||
|
||||
Error err;
|
||||
FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save C# script file '" + p_path + "'.");
|
||||
|
||||
file->store_string(source);
|
||||
|
||||
|
|
|
|||
|
|
@ -868,7 +868,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir, Vect
|
|||
|
||||
if (!DirAccess::exists(p_proj_dir)) {
|
||||
Error err = da->make_dir_recursive(p_proj_dir);
|
||||
ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, ERR_CANT_CREATE, "Cannot create directory '" + p_proj_dir + "'.");
|
||||
}
|
||||
|
||||
da->change_dir(p_proj_dir);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ void GDMonoLog::_delete_old_log_files(const String &p_logs_dir) {
|
|||
ERR_FAIL_COND(!da);
|
||||
|
||||
Error err = da->change_dir(p_logs_dir);
|
||||
ERR_FAIL_COND(err != OK);
|
||||
ERR_FAIL_COND_MSG(err != OK, "Cannot change directory to '" + p_logs_dir + "'.");
|
||||
|
||||
ERR_FAIL_COND(da->list_dir_begin() != OK);
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ Error read_all_file_utf8(const String &p_path, String &r_content) {
|
|||
PoolVector<uint8_t> sourcef;
|
||||
Error err;
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||
ERR_FAIL_COND_V(err != OK, err);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot open file '" + p_path + "'.");
|
||||
|
||||
int len = f->get_len();
|
||||
sourcef.resize(len + 1);
|
||||
|
|
|
|||
|
|
@ -119,9 +119,7 @@ Error AudioStreamPlaybackOpus::_load_stream() {
|
|||
Error err;
|
||||
f = FileAccess::open(file, FileAccess::READ, &err);
|
||||
|
||||
if (err) {
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Cannot open file '" + file + "'.");
|
||||
|
||||
int _err = 0;
|
||||
|
||||
|
|
@ -185,9 +183,7 @@ Error AudioStreamPlaybackOpus::set_file(const String &p_file) {
|
|||
Error err;
|
||||
f = FileAccess::open(file, FileAccess::READ, &err);
|
||||
|
||||
if (err) {
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Cannot open file '" + file + "'.");
|
||||
|
||||
int _err;
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
|
|||
|
||||
FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
|
||||
|
||||
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
|
||||
ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file '" + p_source_file + "'.");
|
||||
|
||||
size_t len = f->get_len();
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
|||
memdelete(file);
|
||||
}
|
||||
file = FileAccess::open(p_file, FileAccess::READ);
|
||||
ERR_FAIL_COND(!file);
|
||||
ERR_FAIL_COND_MSG(!file, "Cannot open file '" + p_file + "'.");
|
||||
|
||||
#ifdef THEORA_USE_THREAD_STREAMING
|
||||
thread_exit = false;
|
||||
|
|
|
|||
|
|
@ -242,10 +242,7 @@ Error AudioStreamPlaybackOGGVorbis::set_file(const String &p_file) {
|
|||
stream_valid = false;
|
||||
Error err;
|
||||
f = FileAccess::open(file, FileAccess::READ, &err);
|
||||
|
||||
if (err) {
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Cannot open file '" + p_file + "'.");
|
||||
|
||||
int errv = ov_open_callbacks(f, &vf, NULL, 0, _ov_callbacks);
|
||||
switch (errv) {
|
||||
|
|
@ -294,9 +291,7 @@ Error AudioStreamPlaybackOGGVorbis::_load_stream() {
|
|||
|
||||
Error err;
|
||||
f = FileAccess::open(file, FileAccess::READ, &err);
|
||||
if (err) {
|
||||
ERR_FAIL_COND_V(err, err);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot open file '" + file + "'.");
|
||||
|
||||
int errv = ov_open_callbacks(f, &vf, NULL, 0, _ov_callbacks);
|
||||
switch (errv) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue