summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2011-01-10 13:57:21 +0000
committerEmile Joubert <emile@rabbitmq.com>2011-01-10 13:57:21 +0000
commit831b609b58447daa4e40b192c836a6ecf92f896a (patch)
tree27c0d4f3c3ccf50966a44f003eb5c7e952d06420
parent0b0c6bab087340bb45ea031515b2d45a121869e6 (diff)
downloadrabbitmq-server-831b609b58447daa4e40b192c836a6ecf92f896a.tar.gz
Unconditionally return a fun() in execute mnesia tx
-rw-r--r--src/rabbit_binding.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl
index aad501ba..f667ab40 100644
--- a/src/rabbit_binding.erl
+++ b/src/rabbit_binding.erl
@@ -297,13 +297,17 @@ sync_binding(Binding, Durable, Fun) ->
call_with_source_and_destination(SrcName, DstName, Fun) ->
SrcTable = table_for_resource(SrcName),
DstTable = table_for_resource(DstName),
+ ErrFun = fun (Err) ->
+ fun (_Tx) -> Err end
+ end,
rabbit_misc:execute_mnesia_tx_with_tail(
fun () -> case {mnesia:read({SrcTable, SrcName}),
mnesia:read({DstTable, DstName})} of
{[Src], [Dst]} -> Fun(Src, Dst);
- {[], [_] } -> {error, source_not_found};
- {[_], [] } -> {error, destination_not_found};
- {[], [] } -> {error, source_and_destination_not_found}
+ {[], [_] } -> ErrFun({error, source_not_found});
+ {[_], [] } -> ErrFun({error, destination_not_found});
+ {[], [] } ->
+ ErrFun({error, source_and_destination_not_found})
end
end).