diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-01-09 18:32:26 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-01-09 18:32:26 +0100 |
commit | 854aa554533fcb5f93559220b474043f28ce45d4 (patch) | |
tree | 1bb409371616df3162cc4dae62ed3ddf90b80a1e /source/theme.c | |
parent | a199fa3275c2bf2dfe6320de1410266ac626c6db (diff) |
Better error reporting (1)
Diffstat (limited to 'source/theme.c')
-rw-r--r-- | source/theme.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/theme.c b/source/theme.c index ecb475a9..65810073 100644 --- a/source/theme.c +++ b/source/theme.c @@ -263,9 +263,12 @@ extern FILE* yyin; */ void yyerror ( YYLTYPE *yylloc, const char* s ) { - fprintf ( stderr, "Parse error: %s\n", s ); - fprintf ( stderr, "From line %d column %d to line %d column %d\n", yylloc->first_line, yylloc->first_column, yylloc->last_line, yylloc->last_column ); - exit ( EXIT_FAILURE ); + GString *str = g_string_new ("<big><b>Error while parsing theme file:</b></big>\n"); + char *esc = g_markup_escape_text ( s, -1); + g_string_append_printf(str, "\tParser error: %s\n", esc ); + g_free(esc); + g_string_append_printf(str, "\tLocation: line %d column %d to line %d column %d\n", yylloc->first_line, yylloc->first_column, yylloc->last_line, yylloc->last_column ); + rofi_add_error_message ( str ); } static gboolean rofi_theme_steal_property_int ( gpointer key, gpointer value, gpointer user_data ) @@ -866,7 +869,6 @@ gboolean rofi_theme_parse_file ( const char *file ) g_free ( filename ); yyin = NULL; if ( parser_retv != 0 ){ - fprintf ( stderr, "Failed to parse theme: %s.\n", file ); return TRUE; } return FALSE; |