diff options
| author | David Wragg <dpw@lshift.net> | 2010-05-30 23:31:40 +0100 |
|---|---|---|
| committer | David Wragg <dpw@lshift.net> | 2010-05-30 23:31:40 +0100 |
| commit | 66a0a987914626fc0ea86067a0ea1dd7a2bebdd2 (patch) | |
| tree | 0e400acdd2e7f35ed47b94d51308b142e82dbeac /tools/consume.c | |
| parent | 7e8fbea4c9212774c101e33218d26a0dc992dc03 (diff) | |
| download | rabbitmq-c-github-ask-66a0a987914626fc0ea86067a0ea1dd7a2bebdd2.tar.gz | |
Make error codes returned by librabbitmq functions opaque
Windows doesn't generally use POSIX error codes, which poses a problem
for librabbitmq's approach of using those error codes in its API. So
make the librabbitmq error codes opaque: They are still be integers,
but client code is not supposed to assume anything about them, except
that they can be passed to a new amqp_error_string() function which
returns the corresponding error message
Internally, the error codes are either taken from a set of
librabbitmq-specific values, or correspond to an OS-specific (POSIX or
win32) error code, with a simple encoding to indicate which is which.
Diffstat (limited to 'tools/consume.c')
| -rw-r--r-- | tools/consume.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/consume.c b/tools/consume.c index b6bd5e2..9999960 100644 --- a/tools/consume.c +++ b/tools/consume.c @@ -155,8 +155,7 @@ static void do_consume(amqp_connection_state_t conn, amqp_bytes_t queue, struct pipeline pl; uint64_t delivery_tag; int res = amqp_simple_wait_frame(conn, &frame); - if (res < 0) - die_errno(-res, "waiting for header frame"); + die_amqp_error(res, "waiting for header frame"); if (frame.frame_type != AMQP_FRAME_METHOD || frame.payload.method.id != AMQP_BASIC_DELIVER_METHOD) @@ -170,8 +169,9 @@ static void do_consume(amqp_connection_state_t conn, amqp_bytes_t queue, copy_body(conn, pl.infd); if (finish_pipeline(&pl) && !no_ack) - die_errno(-amqp_basic_ack(conn, 1, delivery_tag, 0), - "basic.ack"); + die_amqp_error(amqp_basic_ack(conn, 1, delivery_tag, + 0), + "basic.ack"); amqp_maybe_release_buffers(conn); } |
