Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion deps/rabbitmq_management/src/rabbit_mgmt_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
is_authorized_vhost_visible_for_monitoring/2,
is_authorized_global_parameters/2]).
-export([user/1]).
-export([bad_request/3, service_unavailable/3, bad_request_exception/4, internal_server_error/4,
-export([bad_request/3, service_unavailable/3, bad_request_exception/4,
internal_server_error/3, internal_server_error/4,
id/2, parse_bool/1, parse_int/1, redirect_to_home/3]).
-export([with_decode/4, not_found/3]).
-export([with_channel/4, with_channel/5]).
Expand Down Expand Up @@ -674,6 +675,9 @@ not_found(Reason, ReqData, Context) ->
method_not_allowed(Reason, ReqData, Context) ->
halt_response(405, method_not_allowed, Reason, ReqData, Context).

internal_server_error(Reason, ReqData, Context) ->
internal_server_error(internal_server_error, Reason, ReqData, Context).

internal_server_error(Error, Reason, ReqData, Context) ->
rabbit_log:error("~ts~n~ts", [Error, Reason]),
halt_response(500, Error, Reason, ReqData, Context).
Expand Down
12 changes: 8 additions & 4 deletions deps/rabbitmq_management/src/rabbit_mgmt_wm_vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,18 @@ accept_content(ReqData0, Context = #context{user = #user{username = Username}})
case rabbit_vhost:put_vhost(Name, Description, Tags, DefaultQT, Trace, Username) of
ok ->
{true, ReqData, Context};
{error, timeout} = E ->
{error, timeout} ->
rabbit_mgmt_util:internal_server_error(
"Timed out while waiting for the vhost to initialise", E,
timeout,
"Timed out waiting for the vhost to initialise",
ReqData0, Context);
{error, E} ->
Reason = iolist_to_binary(
io_lib:format(
"Error occurred while adding vhost: ~tp",
[E])),
rabbit_mgmt_util:internal_server_error(
"Error occured while adding vhost", E,
ReqData0, Context);
Reason, ReqData0, Context);
{'EXIT', {vhost_limit_exceeded,
Explanation}} ->
rabbit_mgmt_util:bad_request(list_to_binary(Explanation), ReqData, Context)
Expand Down