diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2012-02-17 15:51:36 +0000 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2012-02-17 15:51:36 +0000 |
commit | 41e710c49f05c40492d4f004de04d778b515a2b3 (patch) | |
tree | 9ca121db127a3e3040a6bc48b06f4ba5ce965584 | |
parent | c87b42438a3144a22880d31644355bc436b6101d (diff) | |
download | rabbitmq-server-41e710c49f05c40492d4f004de04d778b515a2b3.tar.gz |
move print_error back into control and plugins
-rw-r--r-- | src/rabbit_control.erl | 18 | ||||
-rw-r--r-- | src/rabbit_misc.erl | 6 | ||||
-rw-r--r-- | src/rabbit_plugins.erl | 8 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index d04c3ddd..144f16bd 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -82,7 +82,7 @@ start() -> end, PrintInvalidCommandError = fun () -> - rabbit_misc:print_error( + print_error( "invalid command '~s'", [string:join([atom_to_list(Command) | Args], " ")]) end, @@ -103,24 +103,23 @@ start() -> PrintInvalidCommandError(), usage(); {'EXIT', {badarg, _}} -> - rabbit_misc:print_error("invalid parameter: ~p", [Args]), + print_error("invalid parameter: ~p", [Args]), usage(); {error, Reason} -> - rabbit_misc:print_error("~p", [Reason]), + print_error("~p", [Reason]), rabbit_misc:quit(2); {error_string, Reason} -> - rabbit_misc:print_error("~s", [Reason]), + print_error("~s", [Reason]), rabbit_misc:quit(2); {badrpc, {'EXIT', Reason}} -> - rabbit_misc:print_error("~p", [Reason]), + print_error("~p", [Reason]), rabbit_misc:quit(2); {badrpc, Reason} -> - rabbit_misc:print_error("unable to connect to node ~w: ~w", - [Node, Reason]), + print_error("unable to connect to node ~w: ~w", [Node, Reason]), print_badrpc_diagnostics(Node), rabbit_misc:quit(2); Other -> - rabbit_misc:print_error("~p", [Other]), + print_error("~p", [Other]), rabbit_misc:quit(2) end. @@ -144,6 +143,9 @@ print_report0(Node, {Module, InfoFun, KeysFun}, VHostArg) -> print_badrpc_diagnostics(Node) -> rabbit_misc:format_stderr(rabbit_nodes:diagnostics([Node]), []). +print_error(Format, Args) -> + rabbit_misc:format_stderr("Error: " ++ Format ++ "~n", Args). + stop() -> ok. diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 232cfa44..b6d38172 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -38,8 +38,7 @@ -export([upmap/2, map_in_order/2]). -export([table_filter/3]). -export([dirty_read_all/1, dirty_foreach_key/2, dirty_dump_log/1]). --export([format/2, print_error/2, format_stderr/2, with_local_io/1, - local_info_msg/2]). +-export([format/2, format_stderr/2, with_local_io/1, local_info_msg/2]). -export([start_applications/1, stop_applications/1]). -export([unfold/2, ceil/1, queue_fold/3]). -export([sort_field_table/1]). @@ -549,9 +548,6 @@ format_stderr(Fmt, Args) -> end, ok. -print_error(Format, Args) -> - format_stderr("Error: " ++ Format ++ "~n", Args). - %% Execute Fun using the IO system of the local node (i.e. the node on %% which the code is executing). with_local_io(Fun) -> diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index b9342815..c9c48c3b 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -57,7 +57,7 @@ start() -> Command = list_to_atom(Command0), PrintInvalidCommandError = fun () -> - rabbit_misc:print_error( + print_error( "invalid command '~s'", [string:join([atom_to_list(Command) | Args], " ")]) end, @@ -72,10 +72,10 @@ start() -> PrintInvalidCommandError(), usage(); {error, Reason} -> - rabbit_misc:print_error("~p", [Reason]), + print_error("~p", [Reason]), rabbit_misc:quit(2); Other -> - rabbit_misc:print_error("~p", [Other]), + print_error("~p", [Other]), rabbit_misc:quit(2) end. @@ -394,3 +394,5 @@ report_change() -> ok end. +print_error(Format, Args) -> + rabbit_misc:format_stderr("Error: " ++ Format ++ "~n", Args). |