diff options
| author | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> | 2009-04-13 14:06:45 -0700 |
|---|---|---|
| committer | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> | 2009-04-13 14:06:45 -0700 |
| commit | 397a7ed46b9f7ea4affd38230cf2daf786e4825f (patch) | |
| tree | 5bbc57712920f6a30c7b33db7e00f16259d3b5ee | |
| parent | 9309d63b4780c8c654a2398eafa655f90f34c3f4 (diff) | |
| download | rabbitmq-server-git-397a7ed46b9f7ea4affd38230cf2daf786e4825f.tar.gz | |
Use symbolic constants now available.
| -rw-r--r-- | src/rabbit_channel.erl | 15 | ||||
| -rw-r--r-- | src/rabbit_exchange.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_router.erl | 4 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 089550ba9d..078c160265 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -259,10 +259,7 @@ expand_routing_key_shortcut(_QueueNameBin, RoutingKey, _State) -> RoutingKey. die_precondition_failed(Fmt, Params) -> - %% FIXME: 406 should be replaced with precondition_failed when we - %% move to AMQP spec >=8.1 - rabbit_misc:protocol_error({false, 406, <<"PRECONDITION_FAILED">>}, - Fmt, Params). + rabbit_misc:protocol_error(precondition_failed, Fmt, Params). %% check that an exchange/queue name does not contain the reserved %% "amq." prefix. @@ -774,14 +771,10 @@ deliver(QPids, Mandatory, Immediate, Txn, Message, WriterPid) -> case rabbit_router:deliver(QPids, Mandatory, Immediate, Txn, Message) of {ok, DeliveredQPids} -> DeliveredQPids; {error, unroutable} -> - %% FIXME: 312 should be replaced by the ?NO_ROUTE - %% definition, when we move to >=0-9 - ok = basic_return(Message, WriterPid, 312, <<"unroutable">>), + ok = basic_return(Message, WriterPid, ?NO_ROUTE, <<"unroutable">>), []; - {error, not_delivered} -> - %% FIXME: 313 should be replaced by the ?NO_CONSUMERS - %% definition, when we move to >=0-9 - ok = basic_return(Message, WriterPid, 313, <<"not_delivered">>), + {error, no_consumers} -> + ok = basic_return(Message, WriterPid, ?NO_CONSUMERS, <<"no_consumers">>), [] end. diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 7ce6949da3..c523eda3c0 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -58,7 +58,7 @@ -ifdef(use_specs). -type(publish_res() :: {'ok', [pid()]} | - not_found() | {'error', 'unroutable' | 'not_delivered'}). + not_found() | {'error', 'unroutable' | 'no_consumers'}). -type(bind_res() :: 'ok' | {'error', 'queue_not_found' | 'exchange_not_found'}). -spec(recover/0 :: () -> 'ok'). diff --git a/src/rabbit_router.erl b/src/rabbit_router.erl index 0b06a063a7..afc534f9d4 100644 --- a/src/rabbit_router.erl +++ b/src/rabbit_router.erl @@ -51,7 +51,7 @@ -spec(start_link/0 :: () -> {'ok', pid()} | 'ignore' | {'error', any()}). -spec(deliver/5 :: ([pid()], bool(), bool(), maybe(txn()), message()) -> - {'ok', [pid()]} | {'error', 'unroutable' | 'not_delivered'}). + {'ok', [pid()]} | {'error', 'unroutable' | 'no_consumers'}). -endif. @@ -180,5 +180,5 @@ run_bindings(QPids, IsMandatory, IsImmediate, Txn, Message) -> %% check_delivery(Mandatory, Immediate, {WasRouted, QPids}) check_delivery(true, _ , {false, []}) -> {error, unroutable}; -check_delivery(_ , true, {_ , []}) -> {error, not_delivered}; +check_delivery(_ , true, {_ , []}) -> {error, no_consumers}; check_delivery(_ , _ , {_ , Qs}) -> {ok, Qs}. |
