Skip to content

Commit 043369e

Browse files
committed
tiny refactor
1 parent 0e8c9da commit 043369e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/rabbit_binding.erl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,16 @@ sync_transient_binding(Binding, Fun) ->
281281
call_with_source_and_destination(SrcName, DstName, Fun) ->
282282
SrcTable = table_for_resource(SrcName),
283283
DstTable = table_for_resource(DstName),
284-
ErrFun = fun (Err) -> rabbit_misc:const(Err) end,
284+
ErrFun = fun (Err) -> rabbit_misc:const({error, Err}) end,
285285
rabbit_misc:execute_mnesia_tx_with_tail(
286286
fun () ->
287287
case {mnesia:read({SrcTable, SrcName}),
288288
mnesia:read({DstTable, DstName})} of
289289
{[Src], [Dst]} -> Fun(Src, Dst);
290-
{[], [_] } -> ErrFun({error, source_not_found});
291-
{[_], [] } -> ErrFun({error, destination_not_found});
292-
{[], [] } -> ErrFun({error,
293-
source_and_destination_not_found})
294-
end
290+
{[], [_] } -> ErrFun(source_not_found);
291+
{[_], [] } -> ErrFun(destination_not_found);
292+
{[], [] } -> ErrFun(source_and_destination_not_found)
293+
end
295294
end).
296295

297296
table_for_resource(#resource{kind = exchange}) -> rabbit_exchange;

0 commit comments

Comments
 (0)