diff options
Diffstat (limited to 'src/error.c')
-rw-r--r-- | src/error.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/error.c b/src/error.c index 85f29ba..024e678 100644 --- a/src/error.c +++ b/src/error.c @@ -43,7 +43,7 @@ static char * get_syntax_error_context(const NetplanParser* npp, const int line_num, const int column, GError **error) { GString *message = NULL; - GFile *cur_file = g_file_new_for_path(npp->current.filename); + GFile *cur_file = g_file_new_for_path(npp->current.filepath); GFileInputStream *file_stream; GDataInputStream *stream; gsize len; @@ -106,6 +106,7 @@ gboolean parser_error(const yaml_parser_t* parser, const char* yaml, GError** error) { char *error_context = get_parser_error_context(parser, error); + yaml = yaml ? yaml : "(unnamed file)"; if ((char)*parser->buffer.pointer == '\t') g_set_error(error, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, "%s:%zu:%zu: Invalid YAML: tabs are not allowed for indent:\n%s", @@ -158,7 +159,7 @@ yaml_error(const NetplanParser *npp, const yaml_node_t* node, GError** error, co error_context = get_syntax_error_context(npp, node->start_mark.line, node->start_mark.column, error); g_set_error(error, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, "%s:%zu:%zu: Error in network definition: %s\n%s", - npp->current.filename, + npp->current.filepath, node->start_mark.line + 1, node->start_mark.column + 1, s, |