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 | e1cc08bf92d79152f72baa8888d681f961469ee2 (patch) | |
| tree | 3c7e27b6d7801abd90bba667248122397ae73e2a | |
| parent | 4f6d5399b5c110a22703fa5ac73b9dc0f3149b16 (diff) | |
| download | rabbitmq-server-git-e1cc08bf92d79152f72baa8888d681f961469ee2.tar.gz | |
fix rabbitmqctl error reporting under R15
| -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 20486af52b..22b57b1ae9 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]), |
