Virtual host limit: error type naming
vhost_precondition_failed => vhost_limit_exceeded vhost_limit_exceeded is the error type used by definition import when a per-vhost is exceeded. It feels appropriate for this case, too.
This commit is contained in:
parent
1e4555b3b7
commit
f1a922a17c
|
|
@ -347,7 +347,7 @@ is_over_vhost_limit(Name, Limit) when is_integer(Limit) ->
|
|||
ErrorMsg = rabbit_misc:format("cannot create vhost '~ts': "
|
||||
"vhost limit '~tp' is reached",
|
||||
[Name, Limit]),
|
||||
exit({vhost_precondition_failed, ErrorMsg})
|
||||
exit({vhost_limit_exceeded, ErrorMsg})
|
||||
end.
|
||||
|
||||
%% when definitions are loaded on boot, Username here will be ?INTERNAL_USER,
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ node_connection_limit(Config) ->
|
|||
|
||||
vhost_limit(Config) ->
|
||||
set_vhost_limit(Config, 0),
|
||||
{'EXIT',{vhost_precondition_failed, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"foo">>),
|
||||
{'EXIT',{vhost_limit_exceeded, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"foo">>),
|
||||
|
||||
set_vhost_limit(Config, 5),
|
||||
[ok = rabbit_ct_broker_helpers:add_vhost(Config, integer_to_binary(I)) || I <- lists:seq(1,4)],
|
||||
{'EXIT',{vhost_precondition_failed, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"5">>),
|
||||
{'EXIT',{vhost_limit_exceeded, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"5">>),
|
||||
[rabbit_ct_broker_helpers:delete_vhost(Config, integer_to_binary(I)) || I <- lists:seq(1,4)],
|
||||
|
||||
set_vhost_limit(Config, infinity),
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddVhostCommand do
|
|||
{:error, ExitCodes.exit_usage(), "Unsupported default queue type"}
|
||||
end
|
||||
|
||||
def output({:badrpc, {:EXIT, {:vhost_precondition_failed, msg}}}, _opts) do
|
||||
def output({:badrpc, {:EXIT, {:vhost_limit_exceeded, msg}}}, _opts) do
|
||||
{:error, ExitCodes.exit_usage(), msg}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ accept_content(ReqData0, Context = #context{user = #user{username = Username}})
|
|||
case put_vhost(Name, Description, Tags, DefaultQT, Trace, Username) of
|
||||
ok ->
|
||||
{true, ReqData, Context};
|
||||
{'EXIT', {vhost_precondition_failed,
|
||||
{'EXIT', {vhost_limit_exceeded,
|
||||
Explanation}} ->
|
||||
rabbit_mgmt_util:bad_request(list_to_binary(Explanation), ReqData, Context);
|
||||
{error, timeout} = E ->
|
||||
|
|
|
|||
Loading…
Reference in New Issue