summaryrefslogtreecommitdiff
path: root/examples/example_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example_utils.c')
-rw-r--r--examples/example_utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/example_utils.c b/examples/example_utils.c
index 628572c..48f21f9 100644
--- a/examples/example_utils.c
+++ b/examples/example_utils.c
@@ -61,7 +61,9 @@
void die_on_error(int x, char const *context) {
if (x < 0) {
- fprintf(stderr, "%s: %s\n", context, strerror(-x));
+ char *errstr = amqp_error_string(-x);
+ fprintf(stderr, "%s: %s\n", context, errstr);
+ free(errstr);
exit(1);
}
}
@@ -76,8 +78,7 @@ void die_on_amqp_error(amqp_rpc_reply_t x, char const *context) {
break;
case AMQP_RESPONSE_LIBRARY_EXCEPTION:
- fprintf(stderr, "%s: %s\n", context,
- x.library_errno ? strerror(x.library_errno) : "(end-of-stream)");
+ fprintf(stderr, "%s: %s\n", context, amqp_error_string(x.library_error));
break;
case AMQP_RESPONSE_SERVER_EXCEPTION: