Skip to content

Commit de12df8

Browse files
author
Simon MacMullen
committed
Unwrap amqp_error and rethrow
1 parent 3ea5c8c commit de12df8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rabbit_channel.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ binding_action(Fun, ExchangeNameBin, QueueNameBin, RoutingKey, Arguments,
909909
State),
910910
ExchangeName = rabbit_misc:r(VHostPath, exchange, ExchangeNameBin),
911911
check_read_permitted(ExchangeName, State),
912-
case Fun(ExchangeName, QueueName, ActualRoutingKey, Arguments,
912+
case catch Fun(ExchangeName, QueueName, ActualRoutingKey, Arguments,
913913
fun (_X, Q) ->
914914
rabbit_amqqueue:check_exclusive_access(Q, ReaderPid)
915915
end) of
@@ -926,6 +926,11 @@ binding_action(Fun, ExchangeNameBin, QueueNameBin, RoutingKey, Arguments,
926926
not_found, "no binding ~s between ~s and ~s",
927927
[RoutingKey, rabbit_misc:rs(ExchangeName),
928928
rabbit_misc:rs(QueueName)]);
929+
%% When check_exclusive_access exits with a protocal error this gets
930+
%% wrapped because rabbit_misc:execute_mnesia_transaction uses the
931+
%% worker pool. Unwrap it and exit again.
932+
{error, {amqp_error, _, _, _} = Error} ->
933+
exit(Error);
929934
ok -> return_ok(State, NoWait, ReturnMethod)
930935
end.
931936

0 commit comments

Comments
 (0)