summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/config_file.cpp2
-rw-r--r--core/io/file_access_compressed.cpp26
-rw-r--r--core/io/file_access_encrypted.cpp12
-rw-r--r--core/io/file_access_memory.cpp2
-rw-r--r--core/io/file_access_network.cpp10
-rw-r--r--core/io/file_access_pack.cpp2
-rw-r--r--core/io/file_access_zip.cpp6
-rw-r--r--core/io/image_loader.cpp4
-rw-r--r--core/io/ip.cpp2
-rw-r--r--core/io/ip_address.cpp2
-rw-r--r--core/io/marshalls.cpp6
-rw-r--r--core/io/multiplayer_api.cpp3
-rw-r--r--core/io/packet_peer.cpp6
-rw-r--r--core/io/pck_packer.cpp2
-rw-r--r--core/io/resource_format_binary.cpp24
-rw-r--r--core/io/resource_loader.cpp2
-rw-r--r--core/io/resource_saver.cpp4
-rw-r--r--core/io/stream_peer.cpp2
-rw-r--r--core/io/translation_loader_po.cpp2
-rw-r--r--core/io/xml_parser.cpp2
20 files changed, 60 insertions, 61 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index 9063e028be..271e5c5a0b 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -111,7 +111,7 @@ void ConfigFile::get_sections(List<String> *r_sections) const {
}
void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys) const {
- ERR_FAIL_COND(!values.has(p_section));
+ ERR_FAIL_COND_MSG(!values.has(p_section), "Cannont get keys from nonexistent section '" + p_section + "'.");
for (OrderedHashMap<String, Variant>::ConstElement E = values[p_section].front(); E; E = E.next()) {
r_keys->push_back(E.key());
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 102cd9cf6c..a52c6f79c9 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -195,7 +195,7 @@ bool FileAccessCompressed::is_open() const {
void FileAccessCompressed::seek(size_t p_position) {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
if (writing) {
ERR_FAIL_COND(p_position > write_max);
@@ -227,7 +227,7 @@ void FileAccessCompressed::seek(size_t p_position) {
void FileAccessCompressed::seek_end(int64_t p_position) {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
if (writing) {
seek(write_max + p_position);
@@ -238,7 +238,7 @@ void FileAccessCompressed::seek_end(int64_t p_position) {
}
size_t FileAccessCompressed::get_position() const {
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
if (writing) {
return write_pos;
@@ -249,7 +249,7 @@ size_t FileAccessCompressed::get_position() const {
}
size_t FileAccessCompressed::get_len() const {
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
if (writing) {
return write_max;
@@ -260,7 +260,7 @@ size_t FileAccessCompressed::get_len() const {
bool FileAccessCompressed::eof_reached() const {
- ERR_FAIL_COND_V(!f, false);
+ ERR_FAIL_COND_V_MSG(!f, false, "File must be opened before use.");
if (writing) {
return false;
} else {
@@ -270,8 +270,8 @@ bool FileAccessCompressed::eof_reached() const {
uint8_t FileAccessCompressed::get_8() const {
- ERR_FAIL_COND_V(writing, 0);
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
+ ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
if (at_end) {
read_eof = true;
@@ -301,8 +301,8 @@ uint8_t FileAccessCompressed::get_8() const {
}
int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const {
- ERR_FAIL_COND_V(writing, 0);
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
+ ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
if (at_end) {
read_eof = true;
@@ -342,16 +342,16 @@ Error FileAccessCompressed::get_error() const {
}
void FileAccessCompressed::flush() {
- ERR_FAIL_COND(!f);
- ERR_FAIL_COND(!writing);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+ ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
// compressed files keep data in memory till close()
}
void FileAccessCompressed::store_8(uint8_t p_dest) {
- ERR_FAIL_COND(!f);
- ERR_FAIL_COND(!writing);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+ ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
WRITE_FIT(1);
write_ptr[write_pos++] = p_dest;
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index 77decc107d..e45a873978 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -41,7 +41,7 @@
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
- ERR_FAIL_COND_V(file != NULL, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V_MSG(file != NULL, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
pos = 0;
@@ -205,7 +205,7 @@ bool FileAccessEncrypted::eof_reached() const {
uint8_t FileAccessEncrypted::get_8() const {
- ERR_FAIL_COND_V(writing, 0);
+ ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
if (pos >= data.size()) {
eofed = true;
return 0;
@@ -217,7 +217,7 @@ uint8_t FileAccessEncrypted::get_8() const {
}
int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const {
- ERR_FAIL_COND_V(writing, 0);
+ ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
int to_copy = MIN(p_length, data.size() - pos);
for (int i = 0; i < to_copy; i++) {
@@ -239,7 +239,7 @@ Error FileAccessEncrypted::get_error() const {
void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
- ERR_FAIL_COND(!writing);
+ ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
if (pos < data.size()) {
@@ -259,14 +259,14 @@ void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
}
void FileAccessEncrypted::flush() {
- ERR_FAIL_COND(!writing);
+ ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
// encrypted files keep data in memory till close()
}
void FileAccessEncrypted::store_8(uint8_t p_dest) {
- ERR_FAIL_COND(!writing);
+ ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
if (pos < data.size()) {
data.write[pos] = p_dest;
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index fbcf5b8021..c0acd36751 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -90,7 +90,7 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
//name = DirAccess::normalize_path(name);
Map<String, Vector<uint8_t> >::Element *E = files->find(name);
- ERR_FAIL_COND_V(!E, ERR_FILE_NOT_FOUND);
+ ERR_FAIL_COND_V_MSG(!E, ERR_FILE_NOT_FOUND, "Can't find file '" + p_path + "'.");
data = E->get().ptrw();
length = E->get().size();
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index d1c7f5c334..e653a924ba 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -195,7 +195,7 @@ Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const S
DEBUG_PRINT("IP: " + String(ip) + " port " + itos(p_port));
Error err = client->connect_to_host(ip, p_port);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot connect to host with IP: " + String(ip) + " and port: " + itos(p_port));
while (client->get_status() == StreamPeerTCP::STATUS_CONNECTING) {
//DEBUG_PRINT("trying to connect....");
OS::get_singleton()->delay_usec(1000);
@@ -339,7 +339,7 @@ bool FileAccessNetwork::is_open() const {
void FileAccessNetwork::seek(size_t p_position) {
- ERR_FAIL_COND(!opened);
+ ERR_FAIL_COND_MSG(!opened, "File must be opened before use.");
eof_flag = p_position > total_size;
if (p_position >= total_size) {
@@ -355,18 +355,18 @@ void FileAccessNetwork::seek_end(int64_t p_position) {
}
size_t FileAccessNetwork::get_position() const {
- ERR_FAIL_COND_V(!opened, 0);
+ ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use.");
return pos;
}
size_t FileAccessNetwork::get_len() const {
- ERR_FAIL_COND_V(!opened, 0);
+ ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use.");
return total_size;
}
bool FileAccessNetwork::eof_reached() const {
- ERR_FAIL_COND_V(!opened, false);
+ ERR_FAIL_COND_V_MSG(!opened, false, "File must be opened before use.");
return eof_flag;
}
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index d49d36c2b9..a4821e0ce8 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -321,7 +321,7 @@ FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFil
pf(p_file),
f(FileAccess::open(pf.pack, FileAccess::READ)) {
- ERR_FAIL_COND_MSG(!f, "Can't open pack-referenced file: " + String(pf.pack) + ".");
+ ERR_FAIL_COND_MSG(!f, "Can't open pack-referenced file '" + String(pf.pack) + "'.");
f->seek(pf.offset);
pos = 0;
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index be28c9a877..083f56d92c 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -117,7 +117,7 @@ static void godot_free(voidpf opaque, voidpf address) {
void ZipArchive::close_handle(unzFile p_file) const {
- ERR_FAIL_COND(!p_file);
+ ERR_FAIL_COND_MSG(!p_file, "Cannot close a file if none is open.");
FileAccess *f = (FileAccess *)unzGetOpaque(p_file);
unzCloseCurrentFile(p_file);
unzClose(p_file);
@@ -126,11 +126,11 @@ void ZipArchive::close_handle(unzFile p_file) const {
unzFile ZipArchive::get_file_handle(String p_file) const {
- ERR_FAIL_COND_V(!file_exists(p_file), NULL);
+ ERR_FAIL_COND_V_MSG(!file_exists(p_file), NULL, "File '" + p_file + " doesn't exist.");
File file = files[p_file];
FileAccess *f = FileAccess::open(packages[file.package].filename, FileAccess::READ);
- ERR_FAIL_COND_V(!f, NULL);
+ ERR_FAIL_COND_V_MSG(!f, NULL, "Cannot open file '" + packages[file.package].filename + "'.");
zlib_filefunc_def io;
zeromem(&io, sizeof(io));
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index a759e615c7..095c2abb54 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -46,14 +46,14 @@ bool ImageFormatLoader::recognize(const String &p_extension) const {
}
Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom, bool p_force_linear, float p_scale) {
- ERR_FAIL_COND_V(p_image.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V_MSG(p_image.is_null(), ERR_INVALID_PARAMETER, "It's not a reference to a valid Image object.");
FileAccess *f = p_custom;
if (!f) {
Error err;
f = FileAccess::open(p_file, FileAccess::READ, &err);
if (!f) {
- ERR_PRINTS("Error opening file: " + p_file);
+ ERR_PRINTS("Error opening file '" + p_file + "'.");
return err;
}
}
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 3d87131b51..f1b6570799 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -305,7 +305,7 @@ IP *(*IP::_create)() = NULL;
IP *IP::create() {
- ERR_FAIL_COND_V(singleton, NULL);
+ ERR_FAIL_COND_V_MSG(singleton, NULL, "IP singleton already exist.");
ERR_FAIL_COND_V(!_create, NULL);
return _create();
}
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp
index df4be9b9fd..0980027f42 100644
--- a/core/io/ip_address.cpp
+++ b/core/io/ip_address.cpp
@@ -181,7 +181,7 @@ bool IP_Address::is_ipv4() const {
}
const uint8_t *IP_Address::get_ipv4() const {
- ERR_FAIL_COND_V(!is_ipv4(), &(field8[12])); // Not the correct IPv4 (it's an IPv6), but we don't want to return a null pointer risking an engine crash.
+ ERR_FAIL_COND_V_MSG(!is_ipv4(), &(field8[12]), "IPv4 requested, but current IP is IPv6."); // Not the correct IPv4 (it's an IPv6), but we don't want to return a null pointer risking an engine crash.
return &(field8[12]);
}
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index b386feb14c..2ae542bca7 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -478,7 +478,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
int used;
Error err = decode_variant(key, buf, len, &used, p_allow_objects);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to decode Variant.");
buf += used;
len -= used;
@@ -487,7 +487,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
}
err = decode_variant(value, buf, len, &used, p_allow_objects);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to decode Variant.");
buf += used;
len -= used;
@@ -522,7 +522,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
int used = 0;
Variant v;
Error err = decode_variant(v, buf, len, &used, p_allow_objects);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to decode Variant.");
buf += used;
len -= used;
varr.push_back(v);
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index ed6905c9a6..0ba84d0c8f 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -917,8 +917,7 @@ int MultiplayerAPI::_get_bandwidth_usage(const Vector<BandwidthFrame> &p_buffer,
i = (i + p_buffer.size() - 1) % p_buffer.size();
}
- ERR_EXPLAIN("Reached the end of the bandwidth profiler buffer, values might be inaccurate.");
- ERR_FAIL_COND_V(i == p_pointer, total_bandwidth);
+ ERR_FAIL_COND_V_MSG(i == p_pointer, total_bandwidth, "Reached the end of the bandwidth profiler buffer, values might be inaccurate.");
return total_bandwidth;
}
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 1c792c43d1..821a04ebad 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -101,9 +101,9 @@ Error PacketPeer::put_var(const Variant &p_packet, bool p_full_objects) {
return OK;
uint8_t *buf = (uint8_t *)alloca(len);
- ERR_FAIL_COND_V(!buf, ERR_OUT_OF_MEMORY);
+ ERR_FAIL_COND_V_MSG(!buf, ERR_OUT_OF_MEMORY, "Out of memory.");
err = encode_variant(p_packet, buf, len, p_full_objects || allow_object_decoding);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to encode Variant.");
return put_packet(buf, len);
}
@@ -150,7 +150,7 @@ void PacketPeer::_bind_methods() {
void PacketPeerStream::_set_stream_peer(REF p_peer) {
- ERR_FAIL_COND(p_peer.is_null());
+ ERR_FAIL_COND_MSG(p_peer.is_null(), "It's not a reference to a valid Resource object.");
set_stream_peer(p_peer);
}
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 1c89bc6268..443f390bb7 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -107,7 +107,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src) {
Error PCKPacker::flush(bool p_verbose) {
- ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V_MSG(!file, ERR_INVALID_PARAMETER, "File must be opened before use.");
// write the index
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 0ad2479b05..e91dd579b5 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -378,10 +378,10 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
for (uint32_t i = 0; i < len; i++) {
Variant key;
Error err = parse_variant(key);
- ERR_FAIL_COND_V(err, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V_MSG(err, ERR_FILE_CORRUPT, "Error when trying to parse Variant.");
Variant value;
err = parse_variant(value);
- ERR_FAIL_COND_V(err, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V_MSG(err, ERR_FILE_CORRUPT, "Error when trying to parse Variant.");
d[key] = value;
}
r_v = d;
@@ -395,7 +395,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
for (uint32_t i = 0; i < len; i++) {
Variant val;
Error err = parse_variant(val);
- ERR_FAIL_COND_V(err, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V_MSG(err, ERR_FILE_CORRUPT, "Error when trying to parse Variant.");
a[i] = val;
}
r_v = a;
@@ -983,7 +983,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
- ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
+ ERR_FAIL_COND_V_MSG(err != OK, Ref<ResourceInteractiveLoader>(), "Cannot open file '" + p_path + "'.");
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
String path = p_original_path != "" ? p_original_path : p_path;
@@ -1032,7 +1032,7 @@ bool ResourceFormatLoaderBinary::handles_type(const String &p_type) const {
void ResourceFormatLoaderBinary::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "Cannot open file '" + p_path + "'.");
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path);
@@ -1046,7 +1046,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
//Error error=OK;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
FileAccess *fw = NULL; //=FileAccess::open(p_path+".depren");
@@ -1066,7 +1066,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
if (err) {
memdelete(fac);
memdelete(facw);
- ERR_FAIL_COND_V(err, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V_MSG(err, ERR_FILE_CORRUPT, "Cannot create file '" + p_path + ".depren'.");
}
fw = facw;
@@ -1076,13 +1076,13 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
//error=ERR_FILE_UNRECOGNIZED;
memdelete(f);
- ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unrecognized binary resource file: " + local_path + ".");
+ ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unrecognized binary resource file '" + local_path + "'.");
} else {
fw = FileAccess::open(p_path + ".depren", FileAccess::WRITE);
if (!fw) {
memdelete(f);
}
- ERR_FAIL_COND_V(!fw, ERR_CANT_CREATE);
+ ERR_FAIL_COND_V_MSG(!fw, ERR_CANT_CREATE, "Cannot create file '" + p_path + ".depren'.");
uint8_t magic[4] = { 'R', 'S', 'R', 'C' };
fw->store_buffer(magic, 4);
@@ -1113,12 +1113,12 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
memdelete(da);
//use the old approach
- WARN_PRINTS("This file is old, so it can't refactor dependencies, opening and resaving: " + p_path + ".");
+ WARN_PRINTS("This file is old, so it can't refactor dependencies, opening and resaving '" + p_path + "'.");
Error err;
f = FileAccess::open(p_path, FileAccess::READ, &err);
- ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(err != OK, ERR_FILE_CANT_OPEN, "Cannot open file '" + p_path + "'.");
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path);
@@ -1751,7 +1751,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
f = FileAccess::open(p_path, FileAccess::WRITE, &err);
}
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot create file '" + p_path + "'.");
relative_paths = p_flags & ResourceSaver::FLAG_RELATIVE_PATHS;
skip_editor = p_flags & ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES;
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 9e954890bc..f3eba44973 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -205,7 +205,7 @@ RES ResourceFormatLoader::load(const String &p_path, const String &p_original_pa
if (r_error)
*r_error = err;
- ERR_FAIL_COND_V(err != OK, RES());
+ ERR_FAIL_COND_V_MSG(err != OK, RES(), "Failed to load resource '" + p_path + "'.");
}
}
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index a9ad62afe6..7aa8732366 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -158,7 +158,7 @@ void ResourceSaver::get_recognized_extensions(const RES &p_resource, List<String
void ResourceSaver::add_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver, bool p_at_front) {
- ERR_FAIL_COND(p_format_saver.is_null());
+ ERR_FAIL_COND_MSG(p_format_saver.is_null(), "It's not a reference to a valid ResourceFormatSaver object.");
ERR_FAIL_COND(saver_count >= MAX_SAVERS);
if (p_at_front) {
@@ -174,7 +174,7 @@ void ResourceSaver::add_resource_format_saver(Ref<ResourceFormatSaver> p_format_
void ResourceSaver::remove_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver) {
- ERR_FAIL_COND(p_format_saver.is_null());
+ ERR_FAIL_COND_MSG(p_format_saver.is_null(), "It's not a reference to a valid ResourceFormatSaver object.");
// Find saver
int i = 0;
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 84b8554d54..f19e055b64 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -370,7 +370,7 @@ Variant StreamPeer::get_var(bool p_allow_objects) {
Variant ret;
err = decode_variant(ret, var.ptr(), len, NULL, p_allow_objects);
- ERR_FAIL_COND_V(err != OK, Variant());
+ ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
return ret;
}
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index e8e71c10ca..9b6888ac21 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -182,7 +182,7 @@ RES TranslationLoaderPO::load(const String &p_path, const String &p_original_pat
*r_error = ERR_CANT_OPEN;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
- ERR_FAIL_COND_V(!f, RES());
+ ERR_FAIL_COND_V_MSG(!f, RES(), "Cannot open file '" + p_path + "'.");
return load_translation(f, r_error);
}
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 9487947365..575c78734f 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -484,7 +484,7 @@ Error XMLParser::open(const String &p_path) {
Error err;
FileAccess *file = 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 + "'.");
length = file->get_len();
ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT);