diff options
author | Badlop <badlop@process-one.net> | 2012-08-27 16:38:52 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2012-08-27 16:38:52 +0200 |
commit | 4147081f0baade39a514f90de36432b62fd6edc1 (patch) | |
tree | 8c5970b4f18c83bab4b768b315e02264809f3823 | |
parent | On shutdown, first stop listeners, then modules (thanks to Vishal Xica)(EJAB-... (diff) |
Added clause so ejabberdctl number of arguments error report works with R15
-rw-r--r-- | src/ejabberd_ctl.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index ceb4c34d7..01b07eafe 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -292,6 +292,7 @@ call_command([CmdString | Args], Auth, AccessCommands) -> Result = ejabberd_commands:execute_command(AccessCommands, Auth, Command, ArgsFormatted), format_result(Result, ResultFormat); + %% This case clause is for Erlang R14 and older {'EXIT', {function_clause,[{lists,zip,[A1, A2]} | _]}} -> {NumCompa, TextCompa} = case {length(A1), length(A2)} of @@ -300,6 +301,16 @@ call_command([CmdString | Args], Auth, AccessCommands) -> end, {io_lib:format("Error: the command ~p requires ~p ~s.", [CmdString, NumCompa, TextCompa]), + wrong_command_arguments}; + %% This case clause is for Erlang R15 and newer + {'EXIT', {function_clause,[{lists,zip,[A1, A2],_} | _]}} -> + {NumCompa, TextCompa} = + case {length(A1), length(A2)} of + {L1, L2} when L1 < L2 -> {L2-L1, "less argument"}; + {L1, L2} when L1 > L2 -> {L1-L2, "more argument"} + end, + {io_lib:format("Error: the command ~p requires ~p ~s.", + [CmdString, NumCompa, TextCompa]), wrong_command_arguments} end end. |