Skip to content

Commit f1a922a

Browse files
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.
1 parent 1e4555b commit f1a922a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

deps/rabbit/src/rabbit_vhost.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ is_over_vhost_limit(Name, Limit) when is_integer(Limit) ->
347347
ErrorMsg = rabbit_misc:format("cannot create vhost '~ts': "
348348
"vhost limit '~tp' is reached",
349349
[Name, Limit]),
350-
exit({vhost_precondition_failed, ErrorMsg})
350+
exit({vhost_limit_exceeded, ErrorMsg})
351351
end.
352352

353353
%% when definitions are loaded on boot, Username here will be ?INTERNAL_USER,

deps/rabbit/test/per_node_limit_SUITE.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ node_connection_limit(Config) ->
8888

8989
vhost_limit(Config) ->
9090
set_vhost_limit(Config, 0),
91-
{'EXIT',{vhost_precondition_failed, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"foo">>),
91+
{'EXIT',{vhost_limit_exceeded, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"foo">>),
9292

9393
set_vhost_limit(Config, 5),
9494
[ok = rabbit_ct_broker_helpers:add_vhost(Config, integer_to_binary(I)) || I <- lists:seq(1,4)],
95-
{'EXIT',{vhost_precondition_failed, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"5">>),
95+
{'EXIT',{vhost_limit_exceeded, _}} = rabbit_ct_broker_helpers:add_vhost(Config, <<"5">>),
9696
[rabbit_ct_broker_helpers:delete_vhost(Config, integer_to_binary(I)) || I <- lists:seq(1,4)],
9797

9898
set_vhost_limit(Config, infinity),

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_vhost_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddVhostCommand do
5151
{:error, ExitCodes.exit_usage(), "Unsupported default queue type"}
5252
end
5353

54-
def output({:badrpc, {:EXIT, {:vhost_precondition_failed, msg}}}, _opts) do
54+
def output({:badrpc, {:EXIT, {:vhost_limit_exceeded, msg}}}, _opts) do
5555
{:error, ExitCodes.exit_usage(), msg}
5656
end
5757

deps/rabbitmq_management/src/rabbit_mgmt_wm_vhost.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ accept_content(ReqData0, Context = #context{user = #user{username = Username}})
7070
case put_vhost(Name, Description, Tags, DefaultQT, Trace, Username) of
7171
ok ->
7272
{true, ReqData, Context};
73-
{'EXIT', {vhost_precondition_failed,
73+
{'EXIT', {vhost_limit_exceeded,
7474
Explanation}} ->
7575
rabbit_mgmt_util:bad_request(list_to_binary(Explanation), ReqData, Context);
7676
{error, timeout} = E ->

0 commit comments

Comments
 (0)