Improve rabbitmq-queues {add,delete}_member error messages
when target queue was not found.
This commit is contained in:
parent
d5f16d4ce6
commit
c9221bd717
|
|
@ -43,6 +43,8 @@ defmodule RabbitMQ.CLI.Core.ExitCodes do
|
|||
def exit_code_for({:no_such_vhost, _}), do: exit_dataerr()
|
||||
def exit_code_for({:no_such_user, _}), do: exit_nouser()
|
||||
def exit_code_for(:not_found), do: exit_dataerr()
|
||||
def exit_code_for({:not_found, _vhost, _name}), do: exit_dataerr()
|
||||
def exit_code_for({:not_found, _object_type, _vhost, _name}), do: exit_dataerr()
|
||||
def exit_code_for({:badrpc_multi, :timeout, _}), do: exit_tempfail()
|
||||
def exit_code_for({:badrpc, :timeout}), do: exit_tempfail()
|
||||
def exit_code_for({:badrpc, {:timeout, _}}), do: exit_tempfail()
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ defmodule RabbitMQ.CLI.Queues.Commands.AddMemberCommand do
|
|||
{:error, :classic_queue_not_supported} ->
|
||||
{:error, "Cannot add members to a classic queue"}
|
||||
|
||||
{:error, :not_found} ->
|
||||
{:error, {:not_found, :queue, vhost, name}}
|
||||
|
||||
other ->
|
||||
other
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ defmodule RabbitMQ.CLI.Queues.Commands.DeleteMemberCommand do
|
|||
{:error, :classic_queue_not_supported} ->
|
||||
{:error, "Cannot add members to a classic queue"}
|
||||
|
||||
{:error, :not_found} ->
|
||||
{:error, {:not_found, :queue, vhost, name}}
|
||||
|
||||
other ->
|
||||
other
|
||||
end
|
||||
|
|
|
|||
|
|
@ -468,6 +468,16 @@ defmodule RabbitMQCtl do
|
|||
{:error, ExitCodes.exit_code_for(result), "Virtual host '#{vhost}' does not exist"}
|
||||
end
|
||||
|
||||
defp format_error({:error, {:not_found, vhost, name} = result}, _opts, _) do
|
||||
{:error, ExitCodes.exit_code_for(result),
|
||||
"Object (queue, stream, exchange, etc) '#{name}' was not found in virtual host '#{vhost}}'"}
|
||||
end
|
||||
|
||||
defp format_error({:error, {:not_found, object_type, vhost, name} = result}, _opts, _) do
|
||||
{:error, ExitCodes.exit_code_for(result),
|
||||
"#{object_type} '#{name}' was not found in virtual host '#{vhost}}'"}
|
||||
end
|
||||
|
||||
defp format_error({:error, :not_found = result}, _opts, _) do
|
||||
{:error, ExitCodes.exit_code_for(result),
|
||||
"Object (queue, stream, exchange, etc) was not found"}
|
||||
|
|
|
|||
Loading…
Reference in New Issue