aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-09 20:23:41 -0400
committerDavid Robillard <d@drobilla.net>2022-01-13 23:03:53 -0500
commitbf72cc408db5244881143619236aee20156f4ffd (patch)
treed8f12781c8050e2ee9c0e9d83488838968480f00 /src/world.c
parenta1c18e5585a1b3edbe62f53e768d270e54e4cac5 (diff)
downloadserd-bf72cc408db5244881143619236aee20156f4ffd.tar.gz
serd-bf72cc408db5244881143619236aee20156f4ffd.tar.bz2
serd-bf72cc408db5244881143619236aee20156f4ffd.zip
Add SerdCaret
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/world.c b/src/world.c
index 4413f433..4230448a 100644
--- a/src/world.c
+++ b/src/world.c
@@ -16,6 +16,7 @@
#include "world.h"
+#include "caret.h"
#include "node.h"
#include "serd_config.h"
#include "system.h"
@@ -58,10 +59,13 @@ serd_world_error(const SerdWorld* const world, const SerdError* const e)
if (world->error_func) {
world->error_func(world->error_handle, e);
} else {
- if (e->filename) {
- fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col);
- } else {
- fprintf(stderr, "error: ");
+ fprintf(stderr, "error: ");
+ if (e->caret) {
+ fprintf(stderr,
+ "%s:%u:%u: ",
+ serd_node_string(e->caret->file),
+ e->caret->line,
+ e->caret->col);
}
vfprintf(stderr, e->fmt, *e->args);
}
@@ -76,7 +80,7 @@ serd_world_errorf(const SerdWorld* const world,
{
va_list args;
va_start(args, fmt);
- const SerdError e = {st, NULL, 0, 0, fmt, &args};
+ const SerdError e = {st, NULL, fmt, &args};
serd_world_error(world, &e);
va_end(args);
return st;