From 34aa98fb074dcc7547b79b078d0faf9718a71b4d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 30 Apr 2011 03:16:28 +0000 Subject: Consistent error messages git-svn-id: http://svn.drobilla.net/serd/trunk@152 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- src/node.c | 2 +- src/reader.c | 6 +++--- src/serdi.c | 14 +++++++------- src/writer.c | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/node.c b/src/node.c index 173c5358..7a7a7642 100644 --- a/src/node.c +++ b/src/node.c @@ -130,7 +130,7 @@ serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out) // FIXME: double parse if (!serd_uri_parse(buf, out)) { - fprintf(stderr, "error parsing URI\n"); + fprintf(stderr, "Failed to parse URI <%s>\n", buf); return SERD_NODE_NULL; } diff --git a/src/reader.c b/src/reader.c index 3463c6df..8dec46c7 100644 --- a/src/reader.c +++ b/src/reader.c @@ -260,9 +260,9 @@ pop_string(SerdReader* reader, Ref ref) } #ifdef SERD_STACK_CHECK if (!stack_is_top_string(reader, ref)) { - fprintf(stderr, "attempt to pop non-top string %s\n", + fprintf(stderr, "Attempt to pop non-top string %s\n", deref(reader, ref)->buf); - fprintf(stderr, "top: %s\n", + fprintf(stderr, "... top: %s\n", deref(reader, reader->alloc_stack[reader->n_allocs - 1])->buf); } assert(stack_is_top_string(reader, ref)); @@ -924,7 +924,7 @@ read_literal(SerdReader* reader, Node* dest) } *dest = make_node(SERD_LITERAL, str, datatype.value, lang); } else { - return error(reader, "Unknown literal type\n"); + return error(reader, "unknown literal type\n"); } return true; except: diff --git a/src/serdi.c b/src/serdi.c index 7df0d363..0f843344 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -133,7 +133,7 @@ main(int argc, char** argv) break; } else if (argv[a][1] == 'o') { if (++a == argc) { - fprintf(stderr, "missing value for -o\n"); + fprintf(stderr, "Missing value for -o\n"); return 1; } if (!strcmp(argv[a], "turtle")) { @@ -141,11 +141,11 @@ main(int argc, char** argv) } else if (!strcmp(argv[a], "ntriples")) { output_syntax = SERD_NTRIPLES; } else { - fprintf(stderr, "unknown output format `%s'\n", argv[a]); + fprintf(stderr, "Unknown output format `%s'\n", argv[a]); return 1; } } else { - fprintf(stderr, "unknown option `%s'\n", argv[a]); + fprintf(stderr, "Unknown option `%s'\n", argv[a]); return print_usage(argv[0], true); } } @@ -157,7 +157,7 @@ main(int argc, char** argv) if (serd_uri_string_has_scheme(input)) { // INPUT is an absolute URI, ensure it a file and chop scheme if (strncmp((const char*)input, "file:", 5)) { - fprintf(stderr, "unsupported URI scheme `%s'\n", input); + fprintf(stderr, "Unsupported URI scheme `%s'\n", input); return 1; #ifdef __WIN32__ } else if (!strncmp((const char*)input, "file:///", 8)) { @@ -172,7 +172,7 @@ main(int argc, char** argv) } in_fd = fopen((const char*)input, "r"); if (!in_fd) { - fprintf(stderr, "failed to open file %s\n", input); + fprintf(stderr, "Failed to open file %s\n", input); return 1; } } @@ -183,7 +183,7 @@ main(int argc, char** argv) if (a < argc) { // Base URI given on command line const uint8_t* const in_base_uri = (const uint8_t*)argv[a++]; if (!serd_uri_parse((const uint8_t*)in_base_uri, &base_uri)) { - fprintf(stderr, "invalid base URI `%s'\n", argv[2]); + fprintf(stderr, "Invalid base URI <%s>\n", argv[2]); return 1; } base_uri_str = in_base_uri; @@ -194,7 +194,7 @@ main(int argc, char** argv) } if (!serd_uri_parse(base_uri_str, &base_uri)) { - fprintf(stderr, "invalid base URI `%s'\n", base_uri_str); + fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } FILE* out_fd = stdout; diff --git a/src/writer.c b/src/writer.c index f6077773..67b69166 100644 --- a/src/writer.c +++ b/src/writer.c @@ -105,7 +105,7 @@ write_text(SerdWriter* writer, TextContext ctx, size = 4; c = in & 0x07; } else { - fprintf(stderr, "invalid UTF-8 at offset %zu: %X\n", i, in); + fprintf(stderr, "Invalid UTF-8 at offset %zu: %X\n", i, in); return false; } @@ -206,7 +206,7 @@ write_node(SerdWriter* writer, switch (writer->syntax) { case SERD_NTRIPLES: if (!serd_env_expand(writer->env, node, &uri_prefix, &uri_suffix)) { - fprintf(stderr, "error: undefined namespace prefix `%s'\n", node->buf); + fprintf(stderr, "Undefined namespace prefix `%s'\n", node->buf); return false; } writer->sink("<", 1, writer->stream); @@ -374,7 +374,7 @@ serd_writer_end_anon(SerdWriter* writer, return true; } if (serd_stack_is_empty(&writer->anon_stack)) { - fprintf(stderr, "unexpected end of anonymous node\n"); + fprintf(stderr, "Unexpected end of anonymous node\n"); return false; } assert(writer->indent > 0); -- cgit v1.2.1