Implement error messages in the decoder side.

Update issue 7
Status: Started
This commit is contained in:
Petteri Aimonen
2012-08-24 21:22:20 +03:00
parent ea57f74741
commit 0fb5e5e068
12 changed files with 52 additions and 32 deletions

View File

@@ -69,7 +69,7 @@ int main()
/* Decode and print out the stuff */
if (!print_person(&stream))
{
printf("Parsing failed.\n");
printf("Parsing failed: %s\n", PB_GET_ERROR(&stream));
return 1;
} else {
return 0;

View File

@@ -82,7 +82,7 @@ int main()
pb_istream_t stream = {&callback, stdin, 10000};
if (!print_person(&stream))
{
printf("Parsing failed.\n");
printf("Parsing failed: %s\n", PB_GET_ERROR(&stream));
return 1;
} else {
return 0;

View File

@@ -89,7 +89,7 @@ int main()
/* Decode and print out the stuff */
if (!check_alltypes(&stream))
{
printf("Parsing failed.\n");
printf("Parsing failed: %s\n", PB_GET_ERROR(&stream));
return 1;
} else {
return 0;

View File

@@ -27,7 +27,7 @@ int main()
if (!pb_decode(&stream, MissingField_fields, &msg))
{
printf("Decode failed.\n");
printf("Decode failed: %s\n", PB_GET_ERROR(&stream));
return 2;
}
}