diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-03 04:49:09 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-03 04:49:09 +0200 |
commit | 3968529cad2baec099acff5fee47b5fe24624b03 (patch) | |
tree | f1140cb53fcb8b5359f29bb4bcff851124d56752 /src/error.c | |
parent | a8ec8e389166adc1231930028bf845da5f9f40ef (diff) | |
download | blogc-3968529cad2baec099acff5fee47b5fe24624b03.tar.gz blogc-3968529cad2baec099acff5fee47b5fe24624b03.tar.bz2 blogc-3968529cad2baec099acff5fee47b5fe24624b03.zip |
error: improved parser error reporting
now it shows a visual indicator '^' pointing to the position of the
error, in the line after the error message. should be helpful for users
writing templates, if any.
Diffstat (limited to 'src/error.c')
-rw-r--r-- | src/error.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/error.c b/src/error.c index 586386a..acce506 100644 --- a/src/error.c +++ b/src/error.c @@ -96,8 +96,8 @@ blogc_error_parser(blogc_error_type_t type, const char *src, size_t src_len, rv = blogc_error_new(type, msg); else rv = blogc_error_new_printf(type, - "%s\nError occurred near line %d, position %d: %s", msg, lineno, - pos, line); + "%s\nError occurred near line %d, position %d:\n%s\n%*s", msg, + lineno, pos, line, pos, "^"); free(msg); free(line); |