From bb031efbe162e845d49b3fb305af777130d142d2 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 15 Oct 2010 09:17:55 +0100 Subject: rename error/2 to prevent auto-import warnings on R14B --- src/rabbit_control.erl | 18 +++++++++--------- src/rabbit_multi.erl | 12 ++++++------ src/rabbit_plugin_activator.erl | 20 +++++++++++--------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 58dedf68..8facaf16 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -94,29 +94,29 @@ start() -> end, halt(); {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> - error("invalid command '~s'", - [lists:flatten( - rabbit_misc:intersperse( - " ", [atom_to_list(Command) | Args]))]), + print_error("invalid command '~s'", + [lists:flatten( + rabbit_misc:intersperse( + " ", [atom_to_list(Command) | Args]))]), usage(); {error, Reason} -> - error("~p", [Reason]), + print_error("~p", [Reason]), halt(2); {badrpc, {'EXIT', Reason}} -> - error("~p", [Reason]), + print_error("~p", [Reason]), halt(2); {badrpc, Reason} -> - 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), halt(2); Other -> - error("~p", [Other]), + print_error("~p", [Other]), halt(2) end. fmt_stderr(Format, Args) -> rabbit_misc:format_stderr(Format ++ "~n", Args). -error(Format, Args) -> fmt_stderr("Error: " ++ Format, Args). +print_error(Format, Args) -> fmt_stderr("Error: " ++ Format, Args). print_badrpc_diagnostics(Node) -> fmt_stderr("diagnostics:", []), diff --git a/src/rabbit_multi.erl b/src/rabbit_multi.erl index 5cfd6a5c..b48d0aa3 100644 --- a/src/rabbit_multi.erl +++ b/src/rabbit_multi.erl @@ -64,20 +64,20 @@ start() -> io:format("done.~n"), halt(); {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> - error("invalid command '~s'", - [lists:flatten( - rabbit_misc:intersperse(" ", FullCommand))]), + print_error("invalid command '~s'", + [lists:flatten( + rabbit_misc:intersperse(" ", FullCommand))]), usage(); timeout -> - error("timeout starting some nodes.", []), + print_error("timeout starting some nodes.", []), halt(1); Other -> - error("~p", [Other]), + print_error("~p", [Other]), halt(2) end end. -error(Format, Args) -> +print_error(Format, Args) -> rabbit_misc:format_stderr("Error: " ++ Format ++ "~n", Args). parse_args([Command | Args]) -> diff --git a/src/rabbit_plugin_activator.erl b/src/rabbit_plugin_activator.erl index c38ef8d2..88300ab4 100644 --- a/src/rabbit_plugin_activator.erl +++ b/src/rabbit_plugin_activator.erl @@ -72,7 +72,8 @@ start() -> %% applications along the way AllApps = case catch sets:to_list(expand_dependencies(RequiredApps)) of {failed_to_load_app, App, Err} -> - error("failed to load application ~s:~n~p", [App, Err]); + terminate("failed to load application ~s:~n~p", + [App, Err]); AppList -> AppList end, @@ -116,19 +117,20 @@ start() -> end, ok; {error, Module, Error} -> - error("generation of boot script file ~s failed:~n~s", - [ScriptFile, Module:format_error(Error)]) + terminate("generation of boot script file ~s failed:~n~s", + [ScriptFile, Module:format_error(Error)]) end, case post_process_script(ScriptFile) of ok -> ok; {error, Reason} -> - error("post processing of boot script file ~s failed:~n~w", - [ScriptFile, Reason]) + terminate("post processing of boot script file ~s failed:~n~w", + [ScriptFile, Reason]) end, case systools:script2boot(RootName) of ok -> ok; - error -> error("failed to compile boot script file ~s", [ScriptFile]) + error -> terminate("failed to compile boot script file ~s", + [ScriptFile]) end, io:format("~w plugins activated:~n", [length(PluginApps)]), [io:format("* ~s-~s~n", [App, proplists:get_value(App, AppVersions)]) @@ -190,11 +192,11 @@ unpack_ez_plugins(SrcDir, DestDir) -> %% Eliminate the contents of the destination directory case delete_recursively(DestDir) of ok -> ok; - {error, E} -> error("Could not delete dir ~s (~p)", [DestDir, E]) + {error, E} -> terminate("Could not delete dir ~s (~p)", [DestDir, E]) end, case filelib:ensure_dir(DestDir ++ "/") of ok -> ok; - {error, E2} -> error("Could not create dir ~s (~p)", [DestDir, E2]) + {error, E2} -> terminate("Could not create dir ~s (~p)", [DestDir, E2]) end, [unpack_ez_plugin(PluginName, DestDir) || PluginName <- filelib:wildcard(SrcDir ++ "/*.ez")]. @@ -261,6 +263,6 @@ process_entry(Entry = {apply,{application,start_boot,[rabbit,permanent]}}) -> process_entry(Entry) -> [Entry]. -error(Fmt, Args) -> +terminate(Fmt, Args) -> io:format("ERROR: " ++ Fmt ++ "~n", Args), halt(1). -- cgit v1.2.1