diff options
author | David Robillard <d@drobilla.net> | 2012-07-05 17:35:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-05 17:35:14 +0000 |
commit | 02a41f39b216ca43056fc2e8183351c077b5dd9c (patch) | |
tree | 1224e6ba637bc4879213786228a1b4d1e7516ea2 /src/serd_internal.h | |
parent | 1c7fb2461a581a501f62a7c72a444147da39787e (diff) | |
download | serd-02a41f39b216ca43056fc2e8183351c077b5dd9c.tar.gz serd-02a41f39b216ca43056fc2e8183351c077b5dd9c.tar.bz2 serd-02a41f39b216ca43056fc2e8183351c077b5dd9c.zip |
Add error callback to reader and writer for custom error reporting.
Add -q option to serdi to suppress all non-data output, e.g. errors.
Resolves #815.
git-svn-id: http://svn.drobilla.net/serd/trunk@354 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r-- | src/serd_internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h index ee55de27..9a875daa 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -290,4 +290,17 @@ uri_is_under(const SerdURI* uri, const SerdURI* root) return true; } +/* Error reporting */ + +static inline void +serd_error(SerdErrorSink error_sink, void* handle, const SerdError* e) +{ + if (error_sink) { + error_sink(handle, e); + } else { + fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col); + vfprintf(stderr, e->fmt, *e->args); + } +} + #endif // SERD_INTERNAL_H |