summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2008-11-30 12:14:33 +0000
committerMatthias Radestock <matthias@lshift.net>2008-11-30 12:14:33 +0000
commit32d4e29a4631352876b5397118f5887bf9359e3a (patch)
tree1cfff7e51d91e33ba2f7a7537409b23feab0db85
parent5e7a2dc8b24c7413645b58891d761afdab356023 (diff)
downloadrabbitmq-server-32d4e29a4631352876b5397118f5887bf9359e3a.tar.gz
consistent display of errors in rabbit_multi
There is some duplication of code in rabbit_control here, but imho it's too little to justify refactoring
-rw-r--r--src/rabbit_multi.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rabbit_multi.erl b/src/rabbit_multi.erl
index c6a7e920..66a560e6 100644
--- a/src/rabbit_multi.erl
+++ b/src/rabbit_multi.erl
@@ -46,18 +46,22 @@ start() ->
io:format("done.~n"),
init:stop();
{'EXIT', {function_clause, [{?MODULE, action, _} | _]}} ->
- io:format("Invalid command ~p~n", [FullCommand]),
+ error("invalid command '~s'",
+ [lists:flatten(
+ rabbit_misc:intersperse(" ", FullCommand))]),
usage();
timeout ->
- io:format("timeout starting some nodes.~n"),
+ error("timeout starting some nodes.", []),
halt(1);
Other ->
- io:format("~nrabbit_multi action ~p failed:~n~p~n",
- [Command, Other]),
+ error("~p", [Other]),
halt(2)
end
end.
+error(Format, Args) ->
+ io:format("Error: " ++ Format ++"~n", Args).
+
parse_args([Command | Args]) ->
{list_to_atom(Command), Args}.