aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/error.c3
-rw-r--r--src/error.h1
-rw-r--r--src/file.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/src/error.c b/src/error.c
index 586386a..0c297b9 100644
--- a/src/error.c
+++ b/src/error.c
@@ -122,6 +122,9 @@ blogc_error_print(blogc_error_t *err)
case BLOGC_ERROR_LOADER:
fprintf(stderr, "blogc: error: loader: %s\n", err->msg);
break;
+ case BLOGC_ERROR_FILE:
+ fprintf(stderr, "blogc: error: file: %s\n", err->msg);
+ break;
case BLOGC_WARNING_DATETIME_PARSER:
fprintf(stderr, "blogc: warning: datetime: %s\n", err->msg);
break;
diff --git a/src/error.h b/src/error.h
index caa86b0..acaf49e 100644
--- a/src/error.h
+++ b/src/error.h
@@ -16,6 +16,7 @@ typedef enum {
BLOGC_ERROR_SOURCE_PARSER = 1,
BLOGC_ERROR_TEMPLATE_PARSER,
BLOGC_ERROR_LOADER,
+ BLOGC_ERROR_FILE,
BLOGC_WARNING_DATETIME_PARSER,
} blogc_error_type_t;
diff --git a/src/file.c b/src/file.c
index 6da94a2..547f2f7 100644
--- a/src/file.c
+++ b/src/file.c
@@ -34,7 +34,7 @@ blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err)
if (fp == NULL) {
int tmp_errno = errno;
- *err = blogc_error_new_printf(BLOGC_ERROR_LOADER,
+ *err = blogc_error_new_printf(BLOGC_ERROR_FILE,
"Failed to open file (%s): %s", path, strerror(tmp_errno));
return NULL;
}
@@ -62,7 +62,7 @@ blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err)
fclose(fp);
if (!blogc_utf8_validate_str(str)) {
- *err = blogc_error_new_printf(BLOGC_ERROR_LOADER,
+ *err = blogc_error_new_printf(BLOGC_ERROR_FILE,
"File content is not valid UTF-8: %s", path);
sb_string_free(str, true);
return NULL;