diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-12 19:23:21 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-12 19:23:21 +0000 |
commit | 4aeaddf2e4ecbb315ac94078ad899bceb320b13b (patch) | |
tree | 3c7e27b6d7801abd90bba667248122397ae73e2a | |
parent | 3eed683bbf9e20359b8fa510f95065c3a1adc4a9 (diff) | |
download | rabbitmq-server-bug24674.tar.gz |
fix rabbitmqctl error reporting under R15bug24674
-rw-r--r-- | src/rabbit_control.erl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 20486af5..22b57b1a 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -79,6 +79,12 @@ start() -> io:format(Format ++ " ...~n", Args1) end end, + PrintInvalidCommandError = + fun () -> + print_error("invalid command '~s'", + [string:join([atom_to_list(Command) | Args], " ")]) + end, + %% The reason we don't use a try/catch here is that rpc:call turns %% thrown errors into normal return values case catch action(Command, Node, Args, Opts, Inform) of @@ -88,9 +94,11 @@ start() -> false -> io:format("...done.~n") end, rabbit_misc:quit(0); - {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> - print_error("invalid command '~s'", - [string:join([atom_to_list(Command) | Args], " ")]), + {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> %% < R15 + PrintInvalidCommandError(), + usage(); + {'EXIT', {function_clause, [{?MODULE, action, _, _} | _]}} -> %% >= R15 + PrintInvalidCommandError(), usage(); {'EXIT', {badarg, _}} -> print_error("invalid parameter: ~p", [Args]), |