summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-09-25 11:51:54 +0200
committerGitHub <noreply@github.com>2019-09-25 11:51:54 +0200
commitdec10dd776fca2994277faa3a97b13e70317f784 (patch)
treecea7622b2e2bb0d2cede33274807cb98b4fef856 /drivers
parentde03ee94cc4df1a451c6f64e984b1da307d0f4b4 (diff)
parent17732fe698b835c29f77c84f329b2ed6cab215ce (diff)
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dummy/rasterizer_dummy.h2
-rw-r--r--drivers/unix/file_access_unix.cpp23
-rw-r--r--drivers/unix/os_unix.cpp2
3 files changed, 14 insertions, 13 deletions
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index 3deaef09e7..8d5cf2ebea 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -181,8 +181,8 @@ public:
DummyTexture *t = texture_owner.get(p_texture);
ERR_FAIL_COND(!t);
+ ERR_FAIL_COND_MSG(p_image.is_null(), "It's not a reference to a valid Image object.");
ERR_FAIL_COND(t->format != p_image->get_format());
- ERR_FAIL_COND(p_image.is_null());
ERR_FAIL_COND(src_w <= 0 || src_h <= 0);
ERR_FAIL_COND(src_x < 0 || src_y < 0 || src_x + src_w > p_image->get_width() || src_y + src_h > p_image->get_height());
ERR_FAIL_COND(dst_x < 0 || dst_y < 0 || dst_x + src_w > t->width || dst_y + src_h > t->height);
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 071734eb48..8be1d5d8f3 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -58,7 +58,7 @@
void FileAccessUnix::check_errors() const {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
if (feof(f)) {
@@ -76,7 +76,7 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
path = fix_path(p_path);
//printf("opening %ls, %i\n", path.c_str(), Memory::get_static_mem_usage());
- ERR_FAIL_COND_V(f, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V_MSG(f, ERR_ALREADY_IN_USE, "File is already in use.");
const char *mode_string;
if (p_mode_flags == READ)
@@ -171,7 +171,7 @@ String FileAccessUnix::get_path_absolute() const {
void FileAccessUnix::seek(size_t p_position) {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
last_error = OK;
if (fseek(f, p_position, SEEK_SET))
@@ -180,7 +180,7 @@ void FileAccessUnix::seek(size_t p_position) {
void FileAccessUnix::seek_end(int64_t p_position) {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
if (fseek(f, p_position, SEEK_END))
check_errors();
@@ -188,7 +188,7 @@ void FileAccessUnix::seek_end(int64_t p_position) {
size_t FileAccessUnix::get_position() const {
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
long pos = ftell(f);
if (pos < 0) {
@@ -200,7 +200,7 @@ size_t FileAccessUnix::get_position() const {
size_t FileAccessUnix::get_len() const {
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
long pos = ftell(f);
ERR_FAIL_COND_V(pos < 0, 0);
@@ -219,7 +219,7 @@ bool FileAccessUnix::eof_reached() const {
uint8_t FileAccessUnix::get_8() const {
- ERR_FAIL_COND_V(!f, 0);
+ ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
uint8_t b;
if (fread(&b, 1, 1, f) == 0) {
check_errors();
@@ -230,7 +230,7 @@ uint8_t FileAccessUnix::get_8() const {
int FileAccessUnix::get_buffer(uint8_t *p_dst, int p_length) const {
- ERR_FAIL_COND_V(!f, -1);
+ ERR_FAIL_COND_V_MSG(!f, -1, "File must be opened before use.");
int read = fread(p_dst, 1, p_length, f);
check_errors();
return read;
@@ -243,18 +243,19 @@ Error FileAccessUnix::get_error() const {
void FileAccessUnix::flush() {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
fflush(f);
}
void FileAccessUnix::store_8(uint8_t p_dest) {
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
ERR_FAIL_COND(fwrite(&p_dest, 1, 1, f) != 1);
}
void FileAccessUnix::store_buffer(const uint8_t *p_src, int p_length) {
- ERR_FAIL_COND(!f);
+
+ ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
ERR_FAIL_COND((int)fwrite(p_src, 1, p_length, f) != p_length);
}
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index ab5590dba4..bc57c0b8df 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -298,7 +298,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
}
FILE *f = popen(argss.utf8().get_data(), "r");
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot pipe stream from process running with following arguments '" + argss + "'.");
char buf[65535];