Instead of throwing an error, return protocol_error
This commit is contained in:
parent
23a32e18e7
commit
36f7e8d6f4
|
|
@ -307,8 +307,12 @@ is_compatible(Type, Durable, Exclusive, AutoDelete) ->
|
|||
declare(Q0, Node) ->
|
||||
Q = rabbit_queue_decorator:set(rabbit_policy:set(Q0)),
|
||||
Mod = amqqueue:get_type(Q),
|
||||
ok = check_vhost_queue_limit(Q),
|
||||
Mod:declare(Q, Node).
|
||||
case check_vhost_queue_limit(Q) of
|
||||
ok ->
|
||||
Mod:declare(Q, Node);
|
||||
Error ->
|
||||
Error
|
||||
end.
|
||||
|
||||
-spec delete(amqqueue:amqqueue(), boolean(),
|
||||
boolean(), rabbit_types:username()) ->
|
||||
|
|
@ -771,8 +775,11 @@ check_vhost_queue_limit(Q) ->
|
|||
#resource{name = QueueName} = amqqueue:get_name(Q),
|
||||
VHost = amqqueue:get_vhost(Q),
|
||||
case rabbit_vhost_limit:is_over_queue_limit(VHost) of
|
||||
false -> ok;
|
||||
{true, Limit} -> rabbit_misc:precondition_failed("cannot declare queue '~ts': "
|
||||
"queue limit in vhost '~ts' (~tp) is reached",
|
||||
[QueueName, VHost, Limit])
|
||||
false->
|
||||
ok;
|
||||
{true, Limit} ->
|
||||
{protocol_error, precondition_failed,
|
||||
"cannot declare queue '~ts': "
|
||||
"queue limit in vhost '~ts' (~tp) is reached",
|
||||
[QueueName, VHost, Limit]}
|
||||
end.
|
||||
|
|
|
|||
Loading…
Reference in New Issue